qcobjects-sdk 2.3.24
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 +23 -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/npmpublish.yml +36 -0
- package/CHANGELOG.md +47 -0
- package/CNAME +1 -0
- package/QCObjects-SDK.js +95 -0
- package/README.md +864 -0
- package/README.rst +398 -0
- package/VERSION +1 -0
- package/_config.yml +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 +50 -0
- package/demo-tests/test-component-list.html +40 -0
- package/demo-tests/test-component-notifications.html +30 -0
- package/demo-tests/test-component-slider.html +52 -0
- package/favicon.ico +0 -0
- package/index.rst +398 -0
- package/js/org.qcobjects.cloud.auth.session.data.js +72 -0
- package/js/org.qcobjects.cloud.auth.session.usertoken.js +95 -0
- package/js/org.qcobjects.components.grid.js +59 -0
- package/js/org.qcobjects.components.js +226 -0
- package/js/org.qcobjects.components.list.js +48 -0
- package/js/org.qcobjects.components.notifications.js +168 -0
- package/js/org.qcobjects.components.slider.js +194 -0
- package/js/org.qcobjects.components.splashscreen.js +565 -0
- package/js/org.qcobjects.controllers.form.js +196 -0
- package/js/org.qcobjects.controllers.grid.js +268 -0
- package/js/org.qcobjects.controllers.js +10 -0
- package/js/org.qcobjects.controllers.list.js +229 -0
- package/js/org.qcobjects.controllers.slider.js +132 -0
- package/js/org.qcobjects.controllers.swagger.js +77 -0
- package/js/org.qcobjects.effects.js +262 -0
- package/js/org.qcobjects.i18n_messages.js +55 -0
- package/js/org.qcobjects.modal.controllers.js +42 -0
- package/js/org.qcobjects.modal.effects.js +48 -0
- package/js/org.qcobjects.models.js +40 -0
- package/js/org.qcobjects.tools.canvas.js +52 -0
- package/js/org.qcobjects.tools.js +59 -0
- package/js/org.qcobjects.tools.layouts.js +71 -0
- package/js/org.qcobjects.views.js +37 -0
- package/package.json +48 -0
- 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
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QCObjects SDK 2.3
|
|
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.components",[
|
|
28
|
+
Class("ShadowedComponent",Component,{
|
|
29
|
+
container:null,
|
|
30
|
+
body:null,
|
|
31
|
+
shadowed:true,
|
|
32
|
+
cached:false,
|
|
33
|
+
controller:null,
|
|
34
|
+
view:null,
|
|
35
|
+
data:{},
|
|
36
|
+
_new_:function (o){
|
|
37
|
+
o.body = _DOMCreateElement("div");
|
|
38
|
+
_super_("Component","_new_").call(this,o);
|
|
39
|
+
}
|
|
40
|
+
}),
|
|
41
|
+
Class("FormField",Component,{
|
|
42
|
+
cached:false,
|
|
43
|
+
reload:true,
|
|
44
|
+
createBindingEvents:function (){
|
|
45
|
+
var thisobj = this;
|
|
46
|
+
var _objList;
|
|
47
|
+
if (typeof this.fieldType =="undefined" || this.fieldType == null ){
|
|
48
|
+
_objList = this.body.subelements("*[data-field]"); // every child with data-field set
|
|
49
|
+
} else {
|
|
50
|
+
_objList = this.body.subelements(this.fieldType+"[data-field]"); // every child with data-field set and tagname is equal to fieldType property
|
|
51
|
+
}
|
|
52
|
+
for (var _datak=0;_datak<_objList.length;_datak++){
|
|
53
|
+
var _obj = _objList[_datak];
|
|
54
|
+
_obj.addEventListener("change",function(e){
|
|
55
|
+
logger.debug("Executing change event binding");
|
|
56
|
+
thisobj.executeBindings(e);
|
|
57
|
+
});
|
|
58
|
+
_obj.addEventListener("blur",function(e){
|
|
59
|
+
logger.debug("Executing change event binding");
|
|
60
|
+
thisobj.executeBindings(e);
|
|
61
|
+
});
|
|
62
|
+
_obj.addEventListener("focus",function(e){
|
|
63
|
+
logger.debug("Executing change event binding");
|
|
64
|
+
thisobj.executeBindings(e);
|
|
65
|
+
});
|
|
66
|
+
_obj.addEventListener("keydown",function(e){
|
|
67
|
+
logger.debug("Executing keydown event binding");
|
|
68
|
+
thisobj.executeBindings(e);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
executeBinding:function (_obj){
|
|
73
|
+
var _datamodel = _obj.getAttribute("data-field");
|
|
74
|
+
logger.debug("Binding "+_datamodel+" for "+this.name);
|
|
75
|
+
this.data[_datamodel]=_obj.value;
|
|
76
|
+
},
|
|
77
|
+
executeBindings:function (){
|
|
78
|
+
var _objList;
|
|
79
|
+
if (typeof this.fieldType =="undefined" || this.fieldType == null ){
|
|
80
|
+
_objList = this.body.subelements("*[data-field]"); // every child with data-field set
|
|
81
|
+
} else {
|
|
82
|
+
_objList = this.body.subelements(this.fieldType+"[data-field]"); // every child with data-field set and tagname is equal to fieldType property
|
|
83
|
+
}
|
|
84
|
+
for (var _datak=0;_datak<_objList.length;_datak++){
|
|
85
|
+
var _obj = _objList[_datak];
|
|
86
|
+
var _datamodel = _obj.getAttribute("data-field");
|
|
87
|
+
logger.debug("Binding "+_datamodel+" for "+this.name);
|
|
88
|
+
this.data[_datamodel]=_obj.value;
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
done:function (){
|
|
92
|
+
var thisobj = this;
|
|
93
|
+
thisobj.executeBindings();
|
|
94
|
+
thisobj.createBindingEvents();
|
|
95
|
+
logger.debug("Field loaded: "+thisobj.fieldType+"[name="+thisobj.name+"]");
|
|
96
|
+
}
|
|
97
|
+
}),
|
|
98
|
+
Class("ButtonField",FormField,{
|
|
99
|
+
fieldType:"button"
|
|
100
|
+
}),
|
|
101
|
+
Class("InputField",FormField,{
|
|
102
|
+
fieldType:"input"
|
|
103
|
+
}),
|
|
104
|
+
Class("TextField",FormField,{
|
|
105
|
+
fieldType:"textarea"
|
|
106
|
+
}),
|
|
107
|
+
Class("EmailField",FormField,{
|
|
108
|
+
fieldType:"input"
|
|
109
|
+
}),
|
|
110
|
+
Class("ModalEnclosureComponent",Component,{
|
|
111
|
+
name:"modal",
|
|
112
|
+
tplsource:"inline",
|
|
113
|
+
cached:false,
|
|
114
|
+
basePath:CONFIG.get("modalBasePath",CONFIG.get("remoteSDKPath")),
|
|
115
|
+
data:{},
|
|
116
|
+
_new_:function (o){
|
|
117
|
+
o.body = _DOMCreateElement("div");
|
|
118
|
+
_super_("Component","_new_").call(this,o);
|
|
119
|
+
},
|
|
120
|
+
template:`
|
|
121
|
+
<!-- The Modal -->
|
|
122
|
+
<style>
|
|
123
|
+
@import url('https://sdk.qcobjects.dev/css/modal.css');
|
|
124
|
+
</style>
|
|
125
|
+
<div id="modalInstance_{{modalId}}" class="modal">
|
|
126
|
+
|
|
127
|
+
<!-- Modal content -->
|
|
128
|
+
<div class="modal-content">
|
|
129
|
+
<span class="close">×</span>
|
|
130
|
+
{{content}}
|
|
131
|
+
</div>
|
|
132
|
+
|
|
133
|
+
</div>
|
|
134
|
+
`
|
|
135
|
+
}),
|
|
136
|
+
Class("ModalComponent",Component,{
|
|
137
|
+
name:"modal",
|
|
138
|
+
cached:false,
|
|
139
|
+
modalEnclosureComponentClass:"ModalEnclosureComponent",
|
|
140
|
+
basePath: CONFIG.get("modalBasePath",CONFIG.get("remoteSDKPath")),
|
|
141
|
+
controller:null,
|
|
142
|
+
view:null,
|
|
143
|
+
tplsource:"none",
|
|
144
|
+
closeOnClickOutside:false,
|
|
145
|
+
data:{
|
|
146
|
+
content:"",
|
|
147
|
+
modalId:0
|
|
148
|
+
},
|
|
149
|
+
submodal:null,
|
|
150
|
+
modal: function (){
|
|
151
|
+
var modalId = this.data.modalId;
|
|
152
|
+
var modalComponent = this;
|
|
153
|
+
|
|
154
|
+
Tag("#modalInstance_"+parseInt(modalId)+".modal").map(function (modal){
|
|
155
|
+
modal.style.display="block";
|
|
156
|
+
ModalFade.apply(modal,0,1);
|
|
157
|
+
});
|
|
158
|
+
Tag("#modalInstance_"+parseInt(modalId)+".modal .modal-content").map(function (modalcontent){
|
|
159
|
+
ModalMoveDown.apply(modalcontent,0,-document.body.clientHeight,0,0);
|
|
160
|
+
});
|
|
161
|
+
Tag("#modalInstance_"+parseInt(modalId)+".modal .modal-content .close").map(function (closebtn){
|
|
162
|
+
closebtn.addEventListener("click",function (){
|
|
163
|
+
modalComponent.close();
|
|
164
|
+
},false);
|
|
165
|
+
});
|
|
166
|
+
if (modalComponent.closeOnClickOutside){
|
|
167
|
+
window.addEventListener("click",function (){
|
|
168
|
+
modalComponent.close();
|
|
169
|
+
},false);
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
close: function (){
|
|
173
|
+
var modalId = this.data.modalId;
|
|
174
|
+
Tag("#modalInstance_"+parseInt(modalId)+".modal").map(function (modal){
|
|
175
|
+
modal.style.display="block";
|
|
176
|
+
ModalFade.apply(modal,1,0);
|
|
177
|
+
});
|
|
178
|
+
Tag("#modalInstance_"+parseInt(modalId)+".modal .modal-content").map(function (modalcontent){
|
|
179
|
+
ModalMoveUp.apply(modalcontent,0,0,0,-document.body.clientHeight);
|
|
180
|
+
});
|
|
181
|
+
setTimeout(function (){
|
|
182
|
+
Tag("#modalInstance_"+parseInt(modalId)+".modal").map(function (modal){
|
|
183
|
+
modal.style.display="none";
|
|
184
|
+
});
|
|
185
|
+
},900);
|
|
186
|
+
},
|
|
187
|
+
_new_:function (o){
|
|
188
|
+
var component = this;
|
|
189
|
+
component.data.modalId = component.__instanceID;
|
|
190
|
+
var submodal = New(ClassFactory(component.modalEnclosureComponentClass),{
|
|
191
|
+
name:component.name,
|
|
192
|
+
basePath:component.basePath,
|
|
193
|
+
data:component.data
|
|
194
|
+
});
|
|
195
|
+
component.subcomponents.push(submodal);
|
|
196
|
+
component.submodal = submodal;
|
|
197
|
+
if (submodal.tplsource == "none"){
|
|
198
|
+
component.body.innerHTML = submodal.parsedAssignmentText;
|
|
199
|
+
} else {
|
|
200
|
+
component.body.append(submodal.body);
|
|
201
|
+
}
|
|
202
|
+
_super_("Component","_new_").call(this,o); // parent call
|
|
203
|
+
},
|
|
204
|
+
done: function ({request,component}){
|
|
205
|
+
_super_("Component","done").call(this,{request:request,component:component}); // parent call
|
|
206
|
+
},
|
|
207
|
+
rebuild:function (){
|
|
208
|
+
this.templateURI = ComponentURI({
|
|
209
|
+
"COMPONENTS_BASE_PATH":CONFIG.get("componentsBasePath"),
|
|
210
|
+
"COMPONENT_NAME":"modal",
|
|
211
|
+
"TPLEXTENSION":CONFIG.get("tplextension"),
|
|
212
|
+
"TPL_SOURCE":"default" //here is always default in order to get the right uri
|
|
213
|
+
});
|
|
214
|
+
return _super_("Component","rebuild").call(this); // parent call
|
|
215
|
+
}
|
|
216
|
+
}),
|
|
217
|
+
Class("SwaggerUIComponent",Component,{
|
|
218
|
+
name:"swagger-ui",
|
|
219
|
+
cached:false,
|
|
220
|
+
basePath: CONFIG.get("remoteSDKPath"),
|
|
221
|
+
tplextension:"tpl.html"
|
|
222
|
+
})
|
|
223
|
+
|
|
224
|
+
]);
|
|
225
|
+
|
|
226
|
+
}).call(null);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QCObjects SDK 2.3
|
|
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
|
+
Class("ListItemComponent",Component,{
|
|
29
|
+
name:"list-item",
|
|
30
|
+
shadowed: false,
|
|
31
|
+
tplsource: "inline",
|
|
32
|
+
template:"<a href=\"{{value}}\">{{label}}</a>",
|
|
33
|
+
cached: false
|
|
34
|
+
}),
|
|
35
|
+
Class("ListComponent",Component,{
|
|
36
|
+
name:"list",
|
|
37
|
+
shadowed: true,
|
|
38
|
+
tplsource: "inline",
|
|
39
|
+
template: "<p>Loading...</p>",
|
|
40
|
+
_new_ (o){
|
|
41
|
+
o.body.setAttribute("controllerClass","ListController");
|
|
42
|
+
o.body.setAttribute("subcomponentClass","ListItemComponent");
|
|
43
|
+
_super_("Component","_new_").call(this,o);
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
]);
|
|
47
|
+
|
|
48
|
+
}).call(null);
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QCObjects SDK 2.3
|
|
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.quickcorp.components.notifications", [
|
|
28
|
+
Class("NotificationComponent", Component, {
|
|
29
|
+
name: "notification",
|
|
30
|
+
cached: false,
|
|
31
|
+
tplsource: "inline",
|
|
32
|
+
shadowed: false,
|
|
33
|
+
body: _DOMCreateElement("div"),
|
|
34
|
+
template: `
|
|
35
|
+
<style>
|
|
36
|
+
div.notification_background {
|
|
37
|
+
display: block; /* Hidden by default */
|
|
38
|
+
position: fixed; /* Stay in place */
|
|
39
|
+
z-index: 1; /* Sit on top */
|
|
40
|
+
padding-top: 100px; /* Location of the box */
|
|
41
|
+
left: 0;
|
|
42
|
+
top: 0;
|
|
43
|
+
bottom:0;
|
|
44
|
+
right:0;
|
|
45
|
+
width: 100%; /* Full width */
|
|
46
|
+
height: 100%; /* Full height */
|
|
47
|
+
overflow: auto; /* Enable scroll if needed */
|
|
48
|
+
background-color: rgb(0,0,0); /* Fallback color */
|
|
49
|
+
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
|
|
50
|
+
border: none !important;
|
|
51
|
+
}
|
|
52
|
+
div.notification {
|
|
53
|
+
border-radius: 12px !important;
|
|
54
|
+
margin-bottom: 15px;
|
|
55
|
+
padding: 4px 12px;
|
|
56
|
+
}
|
|
57
|
+
.notification.danger {
|
|
58
|
+
background-color: #ffdddd;
|
|
59
|
+
border-left: 6px solid #f44336;
|
|
60
|
+
}
|
|
61
|
+
.notification.success {
|
|
62
|
+
background-color: #ddffdd;
|
|
63
|
+
border-left: 6px solid #4CAF50;
|
|
64
|
+
}
|
|
65
|
+
.notification.info {
|
|
66
|
+
background-color: #e7f3fe;
|
|
67
|
+
border-left: 6px solid #2196F3;
|
|
68
|
+
}
|
|
69
|
+
.notification.warning {
|
|
70
|
+
background-color: #ffffcc;
|
|
71
|
+
border-left: 6px solid #ffeb3b;
|
|
72
|
+
}
|
|
73
|
+
</style>
|
|
74
|
+
<div class="notification_background">
|
|
75
|
+
<div class="notification {{kind}}">
|
|
76
|
+
<p><strong>{{title}}</strong> {{message}}</p>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
`,
|
|
80
|
+
kinds: ["danger", "success", "info", "warning"],
|
|
81
|
+
display(element) {
|
|
82
|
+
var _display_ = function (element){
|
|
83
|
+
element.style.display="block";
|
|
84
|
+
var appearEffect = New(Move,{
|
|
85
|
+
duration:900,
|
|
86
|
+
apply (element){
|
|
87
|
+
_super_("Fade","apply").call(this,element,0,1);
|
|
88
|
+
_super_("Move","apply").call(this,element,0,-document.body.clientHeight,0,0);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
var disappearEffect = New(Move,{
|
|
92
|
+
duration:650,
|
|
93
|
+
apply (element){
|
|
94
|
+
_super_("Fade","apply").call(this,element,1,0);
|
|
95
|
+
_super_("Move","apply").call(this,element,0,0,0,-document.body.clientHeight);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
appearEffect.apply(element);
|
|
99
|
+
setTimeout(function (){
|
|
100
|
+
disappearEffect.apply(element);
|
|
101
|
+
},2000);
|
|
102
|
+
};
|
|
103
|
+
element.subelements("div.notification_background").map(element=>New(Fade,{duration:500}).apply(element,0,1));
|
|
104
|
+
element.subelements("div.notification").map(element=>_display_(element));
|
|
105
|
+
setTimeout(function (){
|
|
106
|
+
element.remove();
|
|
107
|
+
},2200);
|
|
108
|
+
},
|
|
109
|
+
success(message) {
|
|
110
|
+
var c = New(NotificationComponent, {
|
|
111
|
+
shadowed: this.shadowed,
|
|
112
|
+
body: _DOMCreateElement("div"),
|
|
113
|
+
data: {
|
|
114
|
+
kind: "success",
|
|
115
|
+
title: "Success!",
|
|
116
|
+
message: `${message}...`
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
document.body.append(c);
|
|
120
|
+
var _componentRoot = (c.shadowed)?(c.shadowRoot.host):(c.body);
|
|
121
|
+
c.display(_componentRoot);
|
|
122
|
+
},
|
|
123
|
+
danger(message) {
|
|
124
|
+
var c = New(NotificationComponent, {
|
|
125
|
+
shadowed: this.shadowed,
|
|
126
|
+
body: _DOMCreateElement("div"),
|
|
127
|
+
data: {
|
|
128
|
+
kind: "danger",
|
|
129
|
+
title: "Danger!",
|
|
130
|
+
message: `${message}...`
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
document.body.append(c);
|
|
134
|
+
var _componentRoot = (c.shadowed)?(c.shadowRoot.host):(c.body);
|
|
135
|
+
c.display(_componentRoot);
|
|
136
|
+
},
|
|
137
|
+
info(message) {
|
|
138
|
+
var c = New(NotificationComponent, {
|
|
139
|
+
shadowed: this.shadowed,
|
|
140
|
+
body: _DOMCreateElement("div"),
|
|
141
|
+
data: {
|
|
142
|
+
kind: "info",
|
|
143
|
+
title: "Info!",
|
|
144
|
+
message: `${message}...`
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
document.body.append(c);
|
|
148
|
+
var _componentRoot = (c.shadowed)?(c.shadowRoot.host):(c.body);
|
|
149
|
+
c.display(_componentRoot);
|
|
150
|
+
},
|
|
151
|
+
warning(message) {
|
|
152
|
+
var c = New(NotificationComponent, {
|
|
153
|
+
shadowed: this.shadowed,
|
|
154
|
+
body: _DOMCreateElement("div"),
|
|
155
|
+
data: {
|
|
156
|
+
kind: "warning",
|
|
157
|
+
title: "Warning!",
|
|
158
|
+
message: `${message}...`
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
document.body.append(c);
|
|
162
|
+
var _componentRoot = (c.shadowed)?(c.shadowRoot.host):(c.body);
|
|
163
|
+
c.display(_componentRoot);
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
]);
|
|
167
|
+
|
|
168
|
+
}).call(null);
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QCObjects SDK 2.3
|
|
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.slider",[
|
|
28
|
+
Class("SlideListComponent",Component,{
|
|
29
|
+
name:"slidelist",
|
|
30
|
+
tplsource: "inline",
|
|
31
|
+
template: "<p>Loading...</p>",
|
|
32
|
+
_new_ (o){
|
|
33
|
+
o.body.setAttribute("controllerClass","DataGridController");
|
|
34
|
+
var subcomponentClass = (o.body.getAttribute("subcomponentClass") !== null)?(o.body.getAttribute("subcomponentClass")):("GridItemComponent");
|
|
35
|
+
o.body.setAttribute("subcomponentClass",subcomponentClass);
|
|
36
|
+
_super_("Component","_new_").call(this,o);
|
|
37
|
+
}
|
|
38
|
+
}),
|
|
39
|
+
Class("SlideItemComponent",Component,{
|
|
40
|
+
name:"slider_item",
|
|
41
|
+
template: `
|
|
42
|
+
<div class="qcoSlides" style="display:none">
|
|
43
|
+
<div class="qco-slider__numbertext">{{slideNumber}} / {{__dataLength}}</div>
|
|
44
|
+
<img src="{{image}}" alt="{{name}}"/>
|
|
45
|
+
<div class="qco-slider__text">
|
|
46
|
+
<p>{{label}} <a href="{{link}}">{{category}}</a></p>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
`,
|
|
50
|
+
tplsource: "inline",
|
|
51
|
+
_new_:function (o){
|
|
52
|
+
|
|
53
|
+
o.data.slideNumber = o.data.__dataIndex + 1;
|
|
54
|
+
|
|
55
|
+
_super_("Component","_new_").call(this,o);
|
|
56
|
+
}
|
|
57
|
+
}),
|
|
58
|
+
|
|
59
|
+
Class("SliderComponent",Component,{
|
|
60
|
+
name:"slider",
|
|
61
|
+
template: `
|
|
62
|
+
<style>
|
|
63
|
+
/* Slideshow container */
|
|
64
|
+
|
|
65
|
+
:host a:hover,
|
|
66
|
+
:host a:active,
|
|
67
|
+
:host a:visited {
|
|
68
|
+
color: #ffffff;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
{
|
|
72
|
+
color: #ffffff;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
:host .prev {left:0;}
|
|
76
|
+
.qco-slider__container {
|
|
77
|
+
max-width: 100%;
|
|
78
|
+
position: relative;
|
|
79
|
+
margin: auto;
|
|
80
|
+
height: 300px;
|
|
81
|
+
}
|
|
82
|
+
:host .qco-slider__container .qcoSlides img {
|
|
83
|
+
object-fit: cover;
|
|
84
|
+
width: 100%;
|
|
85
|
+
height: 300px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* Next & previous buttons */
|
|
89
|
+
:host .prev,
|
|
90
|
+
:host .next {
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
position: absolute;
|
|
93
|
+
top: 50%;
|
|
94
|
+
width: auto;
|
|
95
|
+
margin-top: -22px;
|
|
96
|
+
padding: 16px;
|
|
97
|
+
color: white;
|
|
98
|
+
font-weight: bold;
|
|
99
|
+
font-size: 18px;
|
|
100
|
+
transition: 0.6s ease;
|
|
101
|
+
border-radius: 0 3px 3px 0;
|
|
102
|
+
background-color: rgba(1, 1, 1, 0.1);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* Position the "next button" to the right */
|
|
106
|
+
:host .next {
|
|
107
|
+
right: 0;
|
|
108
|
+
border-radius: 3px 0 0 3px;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/* On hover, add a black background color with a little bit see-through */
|
|
112
|
+
:host .prev:hover,
|
|
113
|
+
:host .next:hover {
|
|
114
|
+
background-color: rgba(0, 0, 0, 0.8);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* Caption text */
|
|
118
|
+
:host .qco-slider__text {
|
|
119
|
+
color: #f2f2f2;
|
|
120
|
+
font-size: 15px;
|
|
121
|
+
/* padding: 8px 12px;*/
|
|
122
|
+
position: absolute;
|
|
123
|
+
bottom: 8px;
|
|
124
|
+
width: 100%;
|
|
125
|
+
text-align: center;
|
|
126
|
+
text-shadow: -1px 1px 3px #111111;
|
|
127
|
+
background-color: rgba(1,1,1,0.7);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* Number text (1/3 etc) */
|
|
131
|
+
:host .qco-slider__numbertext {
|
|
132
|
+
color: #f2f2f2;
|
|
133
|
+
text-shadow: 0px 2px 3px #111111;
|
|
134
|
+
font-size: 12px;
|
|
135
|
+
padding: 8px 12px;
|
|
136
|
+
position: absolute;
|
|
137
|
+
top: 0;
|
|
138
|
+
padding-top: 0;
|
|
139
|
+
margin-top: 10px;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/* The dots/bullets/indicators */
|
|
143
|
+
:host .qcoSlider__dots {
|
|
144
|
+
text-align: center;
|
|
145
|
+
margin: 0 auto;
|
|
146
|
+
padding: 0;
|
|
147
|
+
}
|
|
148
|
+
:host .qcoSlider__dots--dot {
|
|
149
|
+
cursor: pointer;
|
|
150
|
+
height: 10px;
|
|
151
|
+
width: 10px;
|
|
152
|
+
margin: 0 2px;
|
|
153
|
+
background-color: #bbb;
|
|
154
|
+
border-radius: 50%;
|
|
155
|
+
display: inline-block;
|
|
156
|
+
transition: background-color 0.6s ease;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
:host .active,
|
|
160
|
+
:host .qcoSlider__dots--dot:hover {
|
|
161
|
+
background-color: #717171;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
:host .qco-slider__container .qcoSlides img {
|
|
165
|
+
border-radius: 30px 30px 0px 0px;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
</style>
|
|
169
|
+
|
|
170
|
+
<div class="qco-slider__container">
|
|
171
|
+
<component name="slidelist" componentClass="SlideListComponent" subcomponentClass="SlideItemComponent" serviceClass="{{SERVICE_CLASS}}" ></component>
|
|
172
|
+
|
|
173
|
+
<a class="prev" onclick="global.get('{{sliderHandler}}').plusSlidesAndStop(-1)">❮</a>
|
|
174
|
+
<a class="next" onclick="global.get('{{sliderHandler}}').plusSlidesAndStop(1)">❯</a>
|
|
175
|
+
</div>
|
|
176
|
+
<br>
|
|
177
|
+
|
|
178
|
+
<div class="qcoSlider__dots" style="text-align:center">
|
|
179
|
+
</div>
|
|
180
|
+
|
|
181
|
+
`,
|
|
182
|
+
tplsource: "inline",
|
|
183
|
+
shadowed: true,
|
|
184
|
+
_new_(o){
|
|
185
|
+
o.data.SERVICE_CLASS = o.body.getAttribute("serviceClass");
|
|
186
|
+
o.data.sliderHandler = "slider_"+this.__instanceID.toString();
|
|
187
|
+
o.body.setAttribute("controllerClass","SliderController");
|
|
188
|
+
_super_("Component","_new_").call(this,o);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
})
|
|
192
|
+
]);
|
|
193
|
+
|
|
194
|
+
}).call(null);
|