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,241 @@
|
|
|
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.controllers.list", [
|
|
28
|
+
|
|
29
|
+
class ListController extends Controller {
|
|
30
|
+
constructor() {
|
|
31
|
+
super(...arguments);
|
|
32
|
+
this.dependencies = [];
|
|
33
|
+
this.component = null;
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
_new_(o) {
|
|
38
|
+
super.__new__(o);
|
|
39
|
+
var controller = this;
|
|
40
|
+
controller._componentRoot = (controller.component.shadowed) ? (controller.component.shadowRoot) : (controller.component.body);
|
|
41
|
+
|
|
42
|
+
controller.labelField = controller.component.body.getAttribute("label-field");
|
|
43
|
+
controller.valueField = controller.component.body.getAttribute("value-field");
|
|
44
|
+
controller.rows = controller.component.body.getAttribute("rows");
|
|
45
|
+
controller.rows = (controller.rows !== null) ? (controller.rows) : (controller.component.rows);
|
|
46
|
+
controller.cols = 1;
|
|
47
|
+
logger.debug("ListController INIT");
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
getPageIndex(page, totalPage, totalElements) {
|
|
51
|
+
page = new Number(page);
|
|
52
|
+
page = (page > 0) ? (page - 1) : (0);
|
|
53
|
+
totalPage = new Number(totalPage);
|
|
54
|
+
totalElements = new Number(totalElements);
|
|
55
|
+
return [totalElements * page / totalPage, (totalElements * page / totalPage) + totalElements / totalPage];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
addSubcomponents() {
|
|
59
|
+
var controller = this;
|
|
60
|
+
controller.component.subcomponents = [];
|
|
61
|
+
var layout = controller.component.body.getAttribute("layout");
|
|
62
|
+
var basePath = CONFIG.get("listBasePath", CONFIG.get("remoteSDKPath"));
|
|
63
|
+
var cssLayout = "";
|
|
64
|
+
if (layout === "horizontal") {
|
|
65
|
+
cssLayout = `@import url("${basePath}css/components/horizontal-list.css");`;
|
|
66
|
+
} else {
|
|
67
|
+
cssLayout = `@import url("${basePath}css/components/list.css");`;
|
|
68
|
+
}
|
|
69
|
+
controller._componentRoot.innerHTML = `<style>${cssLayout}</style><ul></ul>`;
|
|
70
|
+
logger.debug(_DataStringify(controller.component.data));
|
|
71
|
+
try {
|
|
72
|
+
var subcomponentClass = controller.component.body.getAttribute("subcomponentClass");
|
|
73
|
+
if (subcomponentClass != null) {
|
|
74
|
+
var offset;
|
|
75
|
+
var limit;
|
|
76
|
+
var pagesNumber;
|
|
77
|
+
var list = [...controller.component.data];
|
|
78
|
+
var paginateIn = controller.component.body.getAttribute("paginate-in");
|
|
79
|
+
paginateIn = (paginateIn !== null) ? (paginateIn) : ("client");
|
|
80
|
+
if (paginateIn === "client") {
|
|
81
|
+
var page = controller.component.body.getAttribute("page-number");
|
|
82
|
+
page = (isNaN(page) || page === null) ? (-1) : (page);
|
|
83
|
+
if (page !== -1) {
|
|
84
|
+
pagesNumber = controller.component.body.getAttribute("total-pages");
|
|
85
|
+
pagesNumber = (isNaN(pagesNumber)) ? (1) : (pagesNumber);
|
|
86
|
+
offset = controller.getPageIndex(page, pagesNumber, list.length)[0];
|
|
87
|
+
limit = controller.getPageIndex(page, pagesNumber, list.length)[1];
|
|
88
|
+
} else {
|
|
89
|
+
offset = 0;
|
|
90
|
+
limit = list.length;
|
|
91
|
+
pagesNumber = 1;
|
|
92
|
+
}
|
|
93
|
+
list = list.slice(offset, limit);
|
|
94
|
+
} else {
|
|
95
|
+
offset = 0;
|
|
96
|
+
limit = list.length;
|
|
97
|
+
pagesNumber = 1;
|
|
98
|
+
}
|
|
99
|
+
list.map(
|
|
100
|
+
function (record, dataIndex) {
|
|
101
|
+
try {
|
|
102
|
+
var _body = _DOMCreateElement("li");
|
|
103
|
+
record.label = record[controller.labelField];
|
|
104
|
+
record.value = record[controller.valueField];
|
|
105
|
+
var subcomponent = New(ClassFactory(subcomponentClass), {
|
|
106
|
+
data: {
|
|
107
|
+
label: record[controller.labelField],
|
|
108
|
+
value: record[controller.valueField],
|
|
109
|
+
__dataIndex: dataIndex,
|
|
110
|
+
__page: page,
|
|
111
|
+
__totalPages: pagesNumber,
|
|
112
|
+
__limit: limit,
|
|
113
|
+
__offset: offset
|
|
114
|
+
},
|
|
115
|
+
templateURI: ComponentURI({
|
|
116
|
+
"COMPONENTS_BASE_PATH": CONFIG.get("componentsBasePath"),
|
|
117
|
+
"COMPONENT_NAME": ClassFactory(subcomponentClass).name,
|
|
118
|
+
"TPLEXTENSION": CONFIG.get("tplextension"),
|
|
119
|
+
"TPL_SOURCE": ClassFactory(subcomponentClass).tplsource
|
|
120
|
+
}),
|
|
121
|
+
body: _body,
|
|
122
|
+
template: ClassFactory(subcomponentClass).template
|
|
123
|
+
});
|
|
124
|
+
subcomponent.done = controller.component.done.bind(subcomponent);
|
|
125
|
+
try {
|
|
126
|
+
if (subcomponent) {
|
|
127
|
+
subcomponent.data.__dataIndex = dataIndex;
|
|
128
|
+
if (controller.component.data.hasOwnProperty.call(controller.component.data, "length")) {
|
|
129
|
+
subcomponent.data.__dataLength = controller.component.data.length;
|
|
130
|
+
}
|
|
131
|
+
logger.debug("adding subcomponent to body");
|
|
132
|
+
controller._componentRoot.subelements("ul").map(ul => ul.append(subcomponent));
|
|
133
|
+
try {
|
|
134
|
+
controller.component.subcomponents.push(subcomponent);
|
|
135
|
+
} catch (e) {
|
|
136
|
+
logger.debug("ERROR LOADING SUBCOMPONENT IN DATAGRID");
|
|
137
|
+
}
|
|
138
|
+
} else {
|
|
139
|
+
logger.debug("ERROR LOADING SUBCOMPONENT IN DATAGRID");
|
|
140
|
+
}
|
|
141
|
+
} catch (e) {
|
|
142
|
+
logger.debug("ERROR LOADING SUBCOMPONENT IN DATAGRID");
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
} catch (e) {
|
|
146
|
+
logger.debug("ERROR LOADING SUBCOMPONENT IN DATAGRID");
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
);
|
|
150
|
+
} else {
|
|
151
|
+
logger.debug("NO SUBCOMPONENT CLASS IN COMPONENT");
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
} catch (e) {
|
|
155
|
+
logger.debug("No data for component");
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
cssGrid() {
|
|
160
|
+
var controller = this;
|
|
161
|
+
var component = controller.component;
|
|
162
|
+
var _componentRoot = (component.shadowed) ? (component.shadowRoot) : (component.body);
|
|
163
|
+
if (typeof controller.rows !== "undefined" && typeof controller.cols !== "undefined") {
|
|
164
|
+
var s = _DOMCreateElement("style");
|
|
165
|
+
var templateRows = "auto ".repeat(controller.rows);
|
|
166
|
+
var templateCols = "auto ".repeat(controller.cols);
|
|
167
|
+
var className = "grid" + this.__instanceID.toString();
|
|
168
|
+
s.innerHTML = "." + className + " { \
|
|
169
|
+
display: grid; \
|
|
170
|
+
grid-template-rows: " + templateRows + "; \
|
|
171
|
+
grid-template-columns: " + templateCols + "; \
|
|
172
|
+
margin:0 auto; \
|
|
173
|
+
}";
|
|
174
|
+
_componentRoot.append(s);
|
|
175
|
+
_componentRoot.classList.add(className);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
done() {
|
|
180
|
+
var controller = this;
|
|
181
|
+
controller.cssGrid();
|
|
182
|
+
|
|
183
|
+
var componentInstance = controller.component;
|
|
184
|
+
logger.debug("ListController DONE");
|
|
185
|
+
var serviceClass = controller.component.body.getAttribute("serviceClass");
|
|
186
|
+
if (serviceClass != null) {
|
|
187
|
+
var offset;
|
|
188
|
+
var limit;
|
|
189
|
+
var paginateIn = componentInstance.body.getAttribute("paginate-in");
|
|
190
|
+
paginateIn = (paginateIn !== null) ? (paginateIn) : ("client");
|
|
191
|
+
if (paginateIn === "server") {
|
|
192
|
+
var page = componentInstance.body.getAttribute("page-number");
|
|
193
|
+
page = (isNaN(page) || page === null) ? (-1) : (page);
|
|
194
|
+
var pagesNumber;
|
|
195
|
+
if (page !== -1) {
|
|
196
|
+
var serverDataCount = (controller.component.body.getAttribute("server-data-count") !== null) ? (controller.component.body.getAttribute("server-data-count")) : (1);
|
|
197
|
+
pagesNumber = controller.component.body.getAttribute("total-pages");
|
|
198
|
+
pagesNumber = (isNaN(pagesNumber)) ? (1) : (pagesNumber);
|
|
199
|
+
offset = controller.getPageIndex(page, pagesNumber, serverDataCount)[0];
|
|
200
|
+
limit = controller.getPageIndex(page, pagesNumber, serverDataCount)[1];
|
|
201
|
+
// send params in jsonrpc 2.0 style
|
|
202
|
+
componentInstance.serviceData = (typeof componentInstance.serviceData !== "undefined") ? (componentInstance.serviceData) : ({});
|
|
203
|
+
componentInstance.serviceData.params = (typeof componentInstance.serviceData.params !== "undefined") ? (componentInstance.serviceData.params) : ({});
|
|
204
|
+
componentInstance.serviceData.params.offset = offset;
|
|
205
|
+
componentInstance.serviceData.params.limit = limit;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
serviceLoader(New(ClassFactory(serviceClass), {
|
|
210
|
+
data: componentInstance.serviceData
|
|
211
|
+
})).then(
|
|
212
|
+
(successfulResponse) => {
|
|
213
|
+
// This will show the service response as a plain text
|
|
214
|
+
logger.debug("DONE SERVICE COMPONENT");
|
|
215
|
+
successfulResponse.service.JSONresponse = JSON.parse(successfulResponse.service.template);
|
|
216
|
+
if (typeof successfulResponse.service.JSONresponse.result !== "undefined") {
|
|
217
|
+
logger.debug(_DataStringify(successfulResponse.service.JSONresponse.result));
|
|
218
|
+
componentInstance.data = successfulResponse.service.JSONresponse.result;
|
|
219
|
+
} else {
|
|
220
|
+
componentInstance.data = successfulResponse.service.JSONresponse;
|
|
221
|
+
}
|
|
222
|
+
controller.addSubcomponents();
|
|
223
|
+
|
|
224
|
+
},
|
|
225
|
+
(failedResponse) => {
|
|
226
|
+
logger.debug(failedResponse);
|
|
227
|
+
}).catch((e) => {
|
|
228
|
+
logger.debug("Something went wrong when calling the service from: " + serviceClass);
|
|
229
|
+
logger.debug(e.message);
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
]);
|
|
240
|
+
|
|
241
|
+
}).call(null);
|
|
@@ -0,0 +1,148 @@
|
|
|
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.controllers.slider", [
|
|
28
|
+
|
|
29
|
+
class SliderController extends Controller {
|
|
30
|
+
|
|
31
|
+
constructor() {
|
|
32
|
+
super(...arguments);
|
|
33
|
+
this.dependencies = [];
|
|
34
|
+
this.component = null;
|
|
35
|
+
this.slideIndex = 0;
|
|
36
|
+
this.duration = 7100;
|
|
37
|
+
this.interval = null;
|
|
38
|
+
this.sliderHandlerName = null;
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
_new_(o) {
|
|
43
|
+
super.__new__(o);
|
|
44
|
+
var controller = this;
|
|
45
|
+
var component = controller.component;
|
|
46
|
+
controller._componentRoot = (component.shadowed) ? (component.shadowRoot) : (component.body);
|
|
47
|
+
//TODO: Implement
|
|
48
|
+
controller.sliderHandlerName = "slider_" + controller.component.__instanceID.toString();
|
|
49
|
+
global.set(controller.sliderHandlerName, this);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
stop() {
|
|
53
|
+
if (this.interval != null) {
|
|
54
|
+
clearInterval(this.interval);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
plusSlidesAndStop(n) {
|
|
59
|
+
this.stop();
|
|
60
|
+
this.plusSlides(n);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
plusSlides(n) {
|
|
64
|
+
this.showSlides(this.slideIndex += n);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
currentSlide(n) {
|
|
68
|
+
this.stop();
|
|
69
|
+
this.showSlides(this.slideIndex = n);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
automate() {
|
|
73
|
+
var controller = this;
|
|
74
|
+
controller.interval = setInterval(function () {
|
|
75
|
+
controller.plusSlides(1);
|
|
76
|
+
}, controller.duration);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
showSlides(n) {
|
|
80
|
+
var controller = this;
|
|
81
|
+
var slides = controller._componentRoot.subelements(".qcoSlides");
|
|
82
|
+
var dots = controller._componentRoot.subelements(".qcoSlider__dots--dot");
|
|
83
|
+
|
|
84
|
+
if (n > (slides.length - 1)) {
|
|
85
|
+
controller.slideIndex = 0;
|
|
86
|
+
}
|
|
87
|
+
if (n < 0) {
|
|
88
|
+
controller.slideIndex = 0;
|
|
89
|
+
}
|
|
90
|
+
slides.map((slide) => {
|
|
91
|
+
Fade.apply(slide, 1, 0);
|
|
92
|
+
});
|
|
93
|
+
dots.map((dot) => {
|
|
94
|
+
dot.classList.remove("active");
|
|
95
|
+
});
|
|
96
|
+
try {
|
|
97
|
+
dots[controller.slideIndex].classList.add("active");
|
|
98
|
+
} catch (e) {
|
|
99
|
+
logger.debug("Something went wrong when trying to activate a slide");
|
|
100
|
+
logger.debug(e.message);
|
|
101
|
+
}
|
|
102
|
+
setTimeout(function () {
|
|
103
|
+
slides.map((slide) => {
|
|
104
|
+
slide.style.display = "none";
|
|
105
|
+
});
|
|
106
|
+
try {
|
|
107
|
+
slides[controller.slideIndex].style.display = "block";
|
|
108
|
+
Fade.apply(slides[controller.slideIndex], 0, 1);
|
|
109
|
+
|
|
110
|
+
} catch (e) {
|
|
111
|
+
logger.debug("Something went wrong when trying to show a slide");
|
|
112
|
+
logger.debug(e.message);
|
|
113
|
+
}
|
|
114
|
+
}, 700);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
fillDots() {
|
|
118
|
+
var controller = this;
|
|
119
|
+
var slides = controller._componentRoot.subelements(".qcoSlides");
|
|
120
|
+
slides.map((slide, index) => {
|
|
121
|
+
var dotHTML = document.createElement("span");
|
|
122
|
+
var dotContent = `<span class="qcoSlider__dots--dot" onclick="global.get('${controller.sliderHandlerName}').currentSlide(${index})"></span>`;
|
|
123
|
+
dotHTML.innerHTML = dotContent;
|
|
124
|
+
controller._componentRoot.subelements(".qcoSlider__dots")[0].append(dotHTML);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
done() {
|
|
130
|
+
var controller = this;
|
|
131
|
+
var slides = controller._componentRoot.subelements(".qcoSlides");
|
|
132
|
+
slides.map((slide) => {
|
|
133
|
+
slide.style.display = "none";
|
|
134
|
+
});
|
|
135
|
+
setTimeout(function () {
|
|
136
|
+
controller.fillDots();
|
|
137
|
+
controller.slideIndex = 0;
|
|
138
|
+
controller.showSlides(this.slideIndex);
|
|
139
|
+
controller.automate();
|
|
140
|
+
}, 3000);
|
|
141
|
+
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
]);
|
|
147
|
+
|
|
148
|
+
}).call(null);
|
|
@@ -0,0 +1,86 @@
|
|
|
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.controllers.swagger", [
|
|
28
|
+
|
|
29
|
+
class SwaggerUIController extends Controller {
|
|
30
|
+
constructor() {
|
|
31
|
+
super(...arguments);
|
|
32
|
+
this.dependencies = [];
|
|
33
|
+
this.component = null;
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
startSwaggerUI() {
|
|
38
|
+
// Begin Swagger UI call region
|
|
39
|
+
if (typeof SwaggerUIBundle !== "undefined") {
|
|
40
|
+
/* eslint-disable no-undef */
|
|
41
|
+
const ui = SwaggerUIBundle({
|
|
42
|
+
url: CONFIG.get("swagger-ui-url", "https://petstore.swagger.io/v2/swagger.json"),
|
|
43
|
+
dom_id: "#" + CONFIG.get("swagger-ui-dom_id", "swagger-ui"),
|
|
44
|
+
deepLinking: true,
|
|
45
|
+
presets: [
|
|
46
|
+
SwaggerUIBundle.presets.apis,
|
|
47
|
+
SwaggerUIStandalonePreset
|
|
48
|
+
],
|
|
49
|
+
plugins: [
|
|
50
|
+
SwaggerUIBundle.plugins.DownloadUrl
|
|
51
|
+
],
|
|
52
|
+
layout: "StandaloneLayout"
|
|
53
|
+
});
|
|
54
|
+
// End Swagger UI call region
|
|
55
|
+
window.ui = ui;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
done() {
|
|
61
|
+
var controller = this;
|
|
62
|
+
controller.component.body.innerHTML = "<div id=\"" + CONFIG.get("swagger-ui-dom_id", "swagger-ui") + "\"></div>";
|
|
63
|
+
var swaggerUIPackagePath = CONFIG.get("swagger-ui-package-path", "node_modules/swagger-ui-dist/");
|
|
64
|
+
|
|
65
|
+
this.dependencies.push(New(SourceJS, {
|
|
66
|
+
url: swaggerUIPackagePath + "swagger-ui-standalone-preset.js",
|
|
67
|
+
external: CONFIG.get("swagger-ui-external", false)
|
|
68
|
+
}));
|
|
69
|
+
this.dependencies.push(New(SourceCSS, {
|
|
70
|
+
url: swaggerUIPackagePath + "swagger-ui.css",
|
|
71
|
+
external: CONFIG.get("swagger-ui-external", false)
|
|
72
|
+
}));
|
|
73
|
+
this.dependencies.push(New(SourceJS, {
|
|
74
|
+
url: swaggerUIPackagePath + "swagger-ui-bundle.js",
|
|
75
|
+
external: CONFIG.get("swagger-ui-external", false),
|
|
76
|
+
done: function () {
|
|
77
|
+
controller.startSwaggerUI();
|
|
78
|
+
}
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
]);
|
|
85
|
+
|
|
86
|
+
}).call(null);
|