qcobjectsnewapp 2.4.3 → 2.4.5
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/README.md +131 -142
- package/VERSION +1 -1
- package/css/components/card.css +5 -1
- package/css/components/github-grid-landscape.css +6 -0
- package/css/components/github-grid-portrait.css +6 -0
- package/demo-tests/test-component-grid.html +72 -0
- package/demo-tests/test-component-list.html +54 -0
- package/demo-tests/test-component-notifications.html +62 -0
- package/demo-tests/test-component-slider.html +76 -0
- package/img/logo-qcobjects-version.svg +4 -0
- package/img/octocat.svg +3 -0
- package/index.html +0 -1
- package/js/init.js +7 -4
- package/js/packages/com.qcobjects.services.github.js +118 -0
- package/js/packages/org.quickcorp.custom.components.js +22 -0
- package/js/packages/org.quickcorp.custom.js +1 -0
- package/package.json +6 -6
- package/templates/components/article1.tpl.html +5 -10
- package/templates/components/article2.tpl.html +5 -10
- package/templates/components/card.tpl.html +1 -1
- package/templates/components/footer.tpl.html +12 -1
- package/templates/components/github-card.tpl.html +7 -0
- package/templates/components/layout-basic.tpl.html +11 -2
- package/templates/components/nav.tpl.html +2 -4
- package/templates/components/octocat-icon.tpl.html +11 -0
- package/templates/components/pages/about-of.tpl.html +21 -0
- package/templates/components/pages/author.tpl.html +18 -0
- package/templates/components/pages/page1.tpl.html +2 -1
- package/templates/components/pages/qcobjects-forks-stars.tpl.html +5 -0
- package/templates/components/section1.tpl.html +0 -6
- package/templates/components/section2.tpl.html +1 -1
- package/templates/components/shadowed-card.tpl.html +12 -4
- package/templates/components/signupbuttons.tpl.html +19 -3
- package/templates/components/article3.tpl.html +0 -11
- package/templates/components/article4.tpl.html +0 -12
package/README.md
CHANGED
|
@@ -2,161 +2,150 @@
|
|
|
2
2
|
|
|
3
3
|
This is a demo of a QCObjects based front-end Progressive Web App
|
|
4
4
|
|
|
5
|
+
# Open Live Demo
|
|
6
|
+
|
|
7
|
+
You can view the result of this project opening [QCObjects Demo App](https://newapp.qcobjects.dev) on any browser.
|
|
8
|
+
|
|
5
9
|
# Project Structure
|
|
6
10
|
|
|
7
11
|
The following is the project structure of a Progressive Web App made in QCObjects
|
|
8
12
|
|
|
9
13
|
```shell
|
|
10
|
-
|
|
11
|
-
├── Dockerfile
|
|
12
|
-
├── README.md
|
|
13
|
-
├── VERSION
|
|
14
|
-
├── app.js
|
|
14
|
+
.
|
|
15
15
|
├── css
|
|
16
|
-
├──
|
|
17
|
-
|
|
16
|
+
│ ├── components
|
|
17
|
+
│ │ └── hero
|
|
18
|
+
│ ├── desktop
|
|
19
|
+
│ ├── mobile
|
|
20
|
+
│ └── theme
|
|
21
|
+
│ ├── basic
|
|
22
|
+
│ ├── cyan
|
|
23
|
+
│ ├── redlight
|
|
24
|
+
│ └── xtra
|
|
25
|
+
├── demo-tests
|
|
18
26
|
├── img
|
|
27
|
+
│ ├── icons
|
|
28
|
+
│ └── screenshots
|
|
19
29
|
├── js
|
|
20
|
-
|
|
21
|
-
├── localhost-privkey.pem
|
|
22
|
-
├── manifest.json
|
|
23
|
-
├── package-lock.json
|
|
24
|
-
├── package.json
|
|
25
|
-
├── robots.txt
|
|
30
|
+
│ └── packages
|
|
26
31
|
├── spec
|
|
27
|
-
|
|
32
|
+
│ └── support
|
|
28
33
|
└── templates
|
|
34
|
+
└── components
|
|
35
|
+
├── hero
|
|
36
|
+
└── pages
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
# Entry point
|
|
41
|
+
|
|
42
|
+
In index.html file, you will find this script:
|
|
43
|
+
|
|
44
|
+
```javascript
|
|
45
|
+
<script type="module" src="js/init.js"></script>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
In the init.js file, you will find the main front-end settings:
|
|
49
|
+
|
|
50
|
+
```javascript
|
|
51
|
+
CONFIG.set("sourceType", "module");
|
|
52
|
+
CONFIG.set("relativeImportPath", "js/packages/");
|
|
53
|
+
CONFIG.set("componentsBasePath", "templates/components/");
|
|
54
|
+
CONFIG.set("delayForReady", 1); // delay to wait before executing the first ready event, it includes imports
|
|
55
|
+
CONFIG.set("preserveComponentBodyTag", false); // don't use <componentBody></componentBody> tag
|
|
56
|
+
CONFIG.set("useConfigService", false); // Load settings from config.json
|
|
57
|
+
CONFIG.set("routingWay","hash"); // routingWay possible values are 'hash','pathname','search'
|
|
58
|
+
CONFIG.set("useLocalSDK",true); // on the frontend side you can chose whether to load the SDK from sdk.qcobjects.dev or from your local website
|
|
59
|
+
CONFIG.set("tplextension","tpl.html"); // this is the file extension to locate the template files (if component.name = 'main' then template name will be main.tpl.html)
|
|
60
|
+
CONFIG.set("asynchronousImportsLoad",true); // it is recommended to load the Import declarations in an asyncronous way
|
|
61
|
+
CONFIG.set("serviceWorkerURI","/sw.js"); //QCObjects will register an launch this service worker automatically to work offline
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
You will also find the main imports:
|
|
66
|
+
|
|
67
|
+
```javascript
|
|
68
|
+
// note that this line is pure JavaScript ECMA2020
|
|
69
|
+
import "../QCObjects.js";
|
|
29
70
|
```
|
|
30
71
|
|
|
31
|
-
|
|
72
|
+
```javascript
|
|
73
|
+
Import("org.quickcorp.custom"); // this will load js/packages/org.quickcorp.custom.js file
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Above Import function comes from QCObjects Framework
|
|
77
|
+
You can either use this function or import statement to load QCObjects packages.
|
|
78
|
+
|
|
79
|
+
# Enable QCObjects from local server
|
|
80
|
+
|
|
81
|
+
In package.json file, in scripts section, you will find some common commands that need to be present in every project that works with QCObjects.
|
|
32
82
|
|
|
33
83
|
```shell
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
│ ├── screenshot2.png
|
|
93
|
-
│ └── screenshot2.webp
|
|
94
|
-
├── index.html
|
|
95
|
-
├── js
|
|
96
|
-
│ ├── init.js
|
|
97
|
-
│ └── packages
|
|
98
|
-
│ ├── installer.js
|
|
99
|
-
│ ├── org.quickcorp.custom.components.js
|
|
100
|
-
│ ├── org.quickcorp.custom.controllers.js
|
|
101
|
-
│ ├── org.quickcorp.custom.effects.js
|
|
102
|
-
│ ├── org.quickcorp.custom.js
|
|
103
|
-
│ ├── org.quickcorp.custom.models.js
|
|
104
|
-
│ └── org.quickcorp.custom.views.js
|
|
105
|
-
├── localhost-cert.pem
|
|
106
|
-
├── localhost-privkey.pem
|
|
107
|
-
├── manifest.json
|
|
108
|
-
├── package-lock.json
|
|
109
|
-
├── package.json
|
|
110
|
-
├── robots.txt
|
|
111
|
-
├── spec
|
|
112
|
-
│ ├── support
|
|
113
|
-
│ │ └── jasmine.json
|
|
114
|
-
│ └── testsSpec.js
|
|
115
|
-
├── sw.js
|
|
116
|
-
└── templates
|
|
117
|
-
└── components
|
|
118
|
-
├── article1.tpl.html
|
|
119
|
-
├── article2.tpl.html
|
|
120
|
-
├── article3.tpl.html
|
|
121
|
-
├── article4.tpl.html
|
|
122
|
-
├── blank.tpl.html
|
|
123
|
-
├── card.tpl.html
|
|
124
|
-
├── contentblock.tpl.html
|
|
125
|
-
├── footer.tpl.html
|
|
126
|
-
├── footer2.tpl.html
|
|
127
|
-
├── header.tpl.html
|
|
128
|
-
├── hero
|
|
129
|
-
│ ├── hero-call-to-action.tpl.html
|
|
130
|
-
│ ├── hero-overlay.tpl.html
|
|
131
|
-
│ └── hero-two-column-form.tpl.html
|
|
132
|
-
├── install-button.tpl.html
|
|
133
|
-
├── layout-basic.tpl.html
|
|
134
|
-
├── loading.tpl.html
|
|
135
|
-
├── loadingfooter.tpl.html
|
|
136
|
-
├── login-button.tpl.html
|
|
137
|
-
├── login2.tpl.html
|
|
138
|
-
├── loginform.tpl.html
|
|
139
|
-
├── modal.tpl.html
|
|
140
|
-
├── nav.tpl.html
|
|
141
|
-
├── pages
|
|
142
|
-
│ ├── page1.tpl.html
|
|
143
|
-
│ ├── page2.tpl.html
|
|
144
|
-
│ └── page3.tpl.html
|
|
145
|
-
├── product.tpl.html
|
|
146
|
-
├── profile.tpl.html
|
|
147
|
-
├── pwa.tpl.html
|
|
148
|
-
├── section1.tpl.html
|
|
149
|
-
├── section2.tpl.html
|
|
150
|
-
├── shadowed-card.tpl.html
|
|
151
|
-
├── signin-button.tpl.html
|
|
152
|
-
├── signup-form.tpl.html
|
|
153
|
-
├── signup.tpl.html
|
|
154
|
-
├── signupbuttons.tpl.html
|
|
155
|
-
├── signupform.tpl.html
|
|
156
|
-
├── signuppage.tpl.html
|
|
157
|
-
├── signupsuccessful.tpl.html
|
|
158
|
-
├── signupsuccessfulfooter.tpl.html
|
|
159
|
-
├── splashscreen.tpl.html
|
|
160
|
-
└── topmenu.tpl.html
|
|
84
|
+
# Executes the tests of the project (see spec and coverage folders)
|
|
85
|
+
npm run test
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
```shell
|
|
89
|
+
# Syncronizes the version between npm and git
|
|
90
|
+
npm run sync
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
```shell
|
|
94
|
+
# This command is executed before a npm version is changed
|
|
95
|
+
npm run preversion
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
```shell
|
|
99
|
+
# This command is executed after a npm version is changed
|
|
100
|
+
npm run postversion
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
```shell
|
|
104
|
+
# You can run this command to dispatch the coverage scripts (see coverage folder)
|
|
105
|
+
npm run coverage
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
```shell
|
|
109
|
+
# Start the QCObjects Server
|
|
110
|
+
npm run start
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
```shell
|
|
114
|
+
# An alias to start the QCObjects Server
|
|
115
|
+
npm run serve
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
```shell
|
|
119
|
+
# An alias to start the QCObjects Server
|
|
120
|
+
npm run server
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
```shell
|
|
124
|
+
# This command will open a shell with QCObjects Collab Tool
|
|
125
|
+
npm run collab
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
```shell
|
|
129
|
+
# This command will open a shell with QCObjects running
|
|
130
|
+
npm run shell
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
```shell
|
|
134
|
+
# This command will create a certificate for ssl
|
|
135
|
+
npm run createcert
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
```shell
|
|
139
|
+
# This command will run QCObjects HTTP Server without SSL
|
|
140
|
+
npm run http-server
|
|
141
|
+
```
|
|
161
142
|
|
|
143
|
+
```shell
|
|
144
|
+
# This command will run QCObjects Server adapted for Google App Engine
|
|
145
|
+
npm run gae-server
|
|
162
146
|
```
|
|
147
|
+
|
|
148
|
+
```shell
|
|
149
|
+
# This command will be implemented in the future for TypeScript
|
|
150
|
+
npm run build
|
|
151
|
+
```
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.4.
|
|
1
|
+
2.4.5
|
package/css/components/card.css
CHANGED
|
@@ -32,6 +32,10 @@
|
|
|
32
32
|
border-radius: 30px;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
.img, .title, .description {
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
}
|
|
38
|
+
|
|
35
39
|
.card:hover {
|
|
36
40
|
box-shadow: rgba(228, 228, 234, 0.56) 0 22px 32px 0, rgba(228, 228, 234, 0.64) 0 9px 28px 0;
|
|
37
41
|
}
|
|
@@ -41,7 +45,7 @@
|
|
|
41
45
|
min-height: 100%;
|
|
42
46
|
}
|
|
43
47
|
|
|
44
|
-
.card img {
|
|
48
|
+
.card img, div > div.img {
|
|
45
49
|
border-radius: 30px 30px 0 0;
|
|
46
50
|
min-height: 100px;
|
|
47
51
|
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html class="no-js" lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8" />
|
|
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
|
+
<title>QCObjects Demo</title>
|
|
11
|
+
</head>
|
|
12
|
+
|
|
13
|
+
<body>
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
<my-grid cols=4 componentClass="org.qcobjects.components.grid.GridComponent"
|
|
17
|
+
serviceClass="MyTestService">
|
|
18
|
+
</my-grid>
|
|
19
|
+
|
|
20
|
+
<script type="module">
|
|
21
|
+
//import "../QCObjects.js"; /* uncomment this line to load QCObjects from backend */
|
|
22
|
+
import "https://cdnjs.cloudflare.com/ajax/libs/qcobjects/2.4.52/QCObjects.js"; /* uncomment this line to load QCObjects from cdnjs */
|
|
23
|
+
CONFIG.set("sourceType", "module");
|
|
24
|
+
CONFIG.set("useLocalSDK", false); // on the frontend side you can chose whether to load the SDK from sdk.qcobjects.dev or from your local website
|
|
25
|
+
|
|
26
|
+
logger.debugEnabled = true;
|
|
27
|
+
|
|
28
|
+
Package("com.qcobjects.demo.grid", [
|
|
29
|
+
class MyTestService extends JSONService {
|
|
30
|
+
name = 'myservice';
|
|
31
|
+
external = true;
|
|
32
|
+
cached = false;
|
|
33
|
+
method = 'GET';
|
|
34
|
+
headers = { 'Content-Type': 'application/json' };
|
|
35
|
+
url = 'https://api.github.com/orgs/QuickCorp/repos';
|
|
36
|
+
withCredentials = false;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Creates the instance for MyTestService
|
|
40
|
+
*/
|
|
41
|
+
constructor() {
|
|
42
|
+
super(...arguments);
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
done({ request, service }) {
|
|
47
|
+
logger.debug(request);
|
|
48
|
+
let result = JSON.parse(service.template).reverse().map(function (project) {
|
|
49
|
+
return {
|
|
50
|
+
id: project.id,
|
|
51
|
+
description: project.description,
|
|
52
|
+
title: project.name,
|
|
53
|
+
url: project.html_url,
|
|
54
|
+
image: `https://via.placeholder.com/150/FFFF00/000000?text=${encodeURI(project.name)}`
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
service.template = JSON.stringify({
|
|
59
|
+
result: result
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
])
|
|
67
|
+
|
|
68
|
+
RegisterWidgets("my-grid")
|
|
69
|
+
</script>
|
|
70
|
+
</body>
|
|
71
|
+
|
|
72
|
+
</html>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html class="no-js" lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8" />
|
|
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
|
+
<title>QCObjects Demo</title>
|
|
11
|
+
</head>
|
|
12
|
+
|
|
13
|
+
<body>
|
|
14
|
+
|
|
15
|
+
<my-list componentClass="ListComponent" serviceClass="MyTestService" label-field="name"
|
|
16
|
+
value-field="html_url"></my-list>
|
|
17
|
+
|
|
18
|
+
<script type="module">
|
|
19
|
+
//import "../QCObjects.js"; /* uncomment this line to load QCObjects from backend */
|
|
20
|
+
import "https://cdnjs.cloudflare.com/ajax/libs/qcobjects/2.4.52/QCObjects.js"; /* uncomment this line to load QCObjects from cdnjs */
|
|
21
|
+
CONFIG.set("sourceType", "module");
|
|
22
|
+
CONFIG.set("useLocalSDK", false); // on the frontend side you can chose whether to load the SDK from sdk.qcobjects.dev or from your local website
|
|
23
|
+
logger.debugEnabled = true;
|
|
24
|
+
|
|
25
|
+
Package("com.qcobjects.demo.list", [
|
|
26
|
+
class MyTestService extends JSONService {
|
|
27
|
+
name = 'myservice';
|
|
28
|
+
external = true;
|
|
29
|
+
cached = false;
|
|
30
|
+
method = 'GET';
|
|
31
|
+
headers = { 'Content-Type': 'application/json' };
|
|
32
|
+
url = 'https://api.github.com/orgs/QuickCorp/repos';
|
|
33
|
+
withCredentials = false;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Creates the instance for MyTestService
|
|
37
|
+
*/
|
|
38
|
+
constructor() {
|
|
39
|
+
super(...arguments);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
done(standardResponse) {
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
]);
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
RegisterWidgets("my-list");
|
|
50
|
+
|
|
51
|
+
</script>
|
|
52
|
+
</body>
|
|
53
|
+
|
|
54
|
+
</html>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html class="no-js" lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
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
|
+
<title>QCObjects Demo</title>
|
|
11
|
+
</head>
|
|
12
|
+
|
|
13
|
+
<body>
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
<custom-notification template-source="inline" componentClass="CustomNotificationComponent"></custom-notification>
|
|
17
|
+
|
|
18
|
+
<script type="module">
|
|
19
|
+
//import "../QCObjects.js"; /* uncomment this line to load QCObjects from backend */
|
|
20
|
+
import "https://cdnjs.cloudflare.com/ajax/libs/qcobjects/2.4.52/QCObjects.js"; /* uncomment this line to load QCObjects from cdnjs */
|
|
21
|
+
CONFIG.set("sourceType", "module");
|
|
22
|
+
CONFIG.set("useLocalSDK", false); // on the frontend side you can chose whether to load the SDK from sdk.qcobjects.dev or from your local website
|
|
23
|
+
logger.debugEnabled = true;
|
|
24
|
+
|
|
25
|
+
Package("com.qcobjects.demo.notification", [
|
|
26
|
+
class CustomNotificationComponent extends Component {
|
|
27
|
+
message_start = "Initializing page!";
|
|
28
|
+
message_end = "Page was loaded successfully!";
|
|
29
|
+
template = "...loading";
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Creates the instance for CustomNotificationComponent
|
|
33
|
+
*/
|
|
34
|
+
constructor() {
|
|
35
|
+
super(...arguments);
|
|
36
|
+
NotificationComponent.success(this.message_start)
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* What is inside this function is executed after the component loading is done
|
|
42
|
+
*
|
|
43
|
+
* @param {*} standardResponse it brings all information of the component
|
|
44
|
+
*/
|
|
45
|
+
done(standardResponse) {
|
|
46
|
+
|
|
47
|
+
/* in this case we will call a notification after the component is loaded*/
|
|
48
|
+
return Promise.resolve (
|
|
49
|
+
NotificationComponent.success(this.message_end)
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
]);
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
RegisterWidgets("custom-notification")
|
|
59
|
+
</script>
|
|
60
|
+
</body>
|
|
61
|
+
|
|
62
|
+
</html>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html class="no-js" lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
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
|
+
<title>QCObjects Demo</title>
|
|
11
|
+
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/qcobjects/2.4.20/QCObjects.js"></script>
|
|
12
|
+
</head>
|
|
13
|
+
|
|
14
|
+
<body>
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
<my-slider componentClass="org.qcobjects.components.slider.SliderComponent" serviceClass="GitHubRepoListService"></my-slider>
|
|
18
|
+
|
|
19
|
+
<script type="module">
|
|
20
|
+
//import "../QCObjects.js"; /* uncomment this line to load QCObjects from backend */
|
|
21
|
+
import "https://cdnjs.cloudflare.com/ajax/libs/qcobjects/2.4.52/QCObjects.js"; /* uncomment this line to load QCObjects from cdnjs */
|
|
22
|
+
CONFIG.set("sourceType", "module");
|
|
23
|
+
CONFIG.set("useLocalSDK", false); // on the frontend side you can chose whether to load the SDK from sdk.qcobjects.dev or from your local website
|
|
24
|
+
logger.debugEnabled = true;
|
|
25
|
+
|
|
26
|
+
Package("com.qcobjects.demo.slider.service", [
|
|
27
|
+
class GitHubRepoListService extends Service {
|
|
28
|
+
name = 'myservice';
|
|
29
|
+
external = true;
|
|
30
|
+
cached = false;
|
|
31
|
+
method = 'GET';
|
|
32
|
+
headers = { 'Content-Type': 'application/json' };
|
|
33
|
+
url = 'https://api.github.com/orgs/QuickCorp/repos';
|
|
34
|
+
withCredentials = false;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Creates the instance for MyTestService
|
|
38
|
+
*/
|
|
39
|
+
constructor() {
|
|
40
|
+
super(...arguments);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* What is inside this function is executed after the component loading is done
|
|
45
|
+
*
|
|
46
|
+
* @param {*} standardResponse it brings all information of the component
|
|
47
|
+
*/
|
|
48
|
+
done({ request, service }) {
|
|
49
|
+
logger.debug(request);
|
|
50
|
+
|
|
51
|
+
/* in this case we will parse response and use only the fields we need */
|
|
52
|
+
service.template = JSON.stringify({
|
|
53
|
+
result: JSON.parse(service.template).reverse().map(function (project) {
|
|
54
|
+
return {
|
|
55
|
+
id: project.id,
|
|
56
|
+
description: project.description,
|
|
57
|
+
title: project.name,
|
|
58
|
+
link: project.html_url,
|
|
59
|
+
image: `https://via.placeholder.com/350/999990/000000?text=${encodeURI(project.name)}`,
|
|
60
|
+
label: "Go to repo",
|
|
61
|
+
category: project.name
|
|
62
|
+
};
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
]);
|
|
71
|
+
|
|
72
|
+
RegisterWidgets("my-slider")
|
|
73
|
+
</script>
|
|
74
|
+
</body>
|
|
75
|
+
|
|
76
|
+
</html>
|