qcobjects-sdk 2.4.60 → 2.4.61

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.
Files changed (77) hide show
  1. package/.dockerignore +98 -1
  2. package/.eslintignore +1 -2
  3. package/.github/workflows/static.yml +91 -0
  4. package/VERSION +1 -1
  5. package/config.json +4 -0
  6. package/package.json +31 -9
  7. package/src/QCObjects-SDK.d.ts +26 -0
  8. package/src/QCObjects-SDK.ts +110 -0
  9. package/src/index.d.ts +1 -1
  10. package/src/index.mts +2 -0
  11. package/src/js/org.qcobjects.cloud.auth.session.data.d.ts +1 -0
  12. package/src/js/{org.qcobjects.cloud.auth.session.data.js → org.qcobjects.cloud.auth.session.data.ts} +28 -22
  13. package/src/js/org.qcobjects.cloud.auth.session.usertoken.d.ts +2 -0
  14. package/src/js/org.qcobjects.cloud.auth.session.usertoken.ts +128 -0
  15. package/src/js/org.qcobjects.components.d.ts +10 -0
  16. package/src/js/org.qcobjects.components.grid.d.ts +3 -0
  17. package/src/js/org.qcobjects.components.grid.ts +95 -0
  18. package/src/js/org.qcobjects.components.list.d.ts +3 -0
  19. package/src/js/org.qcobjects.components.list.ts +83 -0
  20. package/src/js/org.qcobjects.components.notifications.d.ts +1 -0
  21. package/src/js/org.qcobjects.components.notifications.ts +191 -0
  22. package/src/js/org.qcobjects.components.slider.d.ts +1 -0
  23. package/src/js/{org.qcobjects.components.slider.js → org.qcobjects.components.slider.ts} +8 -6
  24. package/src/js/org.qcobjects.components.splashscreen.d.ts +28 -0
  25. package/src/js/org.qcobjects.components.splashscreen.ts +680 -0
  26. package/src/js/org.qcobjects.components.ts +336 -0
  27. package/src/js/org.qcobjects.controllers.d.ts +1 -0
  28. package/src/js/org.qcobjects.controllers.form.d.ts +1 -0
  29. package/src/js/{org.qcobjects.controllers.form.js → org.qcobjects.controllers.form.ts} +57 -59
  30. package/src/js/org.qcobjects.controllers.grid.d.ts +1 -0
  31. package/src/js/{org.qcobjects.controllers.grid.js → org.qcobjects.controllers.grid.ts} +102 -97
  32. package/src/js/org.qcobjects.controllers.list.d.ts +1 -0
  33. package/src/js/{org.qcobjects.controllers.list.js → org.qcobjects.controllers.list.ts} +86 -76
  34. package/src/js/org.qcobjects.controllers.slider.d.ts +1 -0
  35. package/src/js/org.qcobjects.controllers.slider.ts +158 -0
  36. package/src/js/org.qcobjects.controllers.swagger.d.ts +1 -0
  37. package/src/js/{org.qcobjects.controllers.swagger.js → org.qcobjects.controllers.swagger.ts} +13 -14
  38. package/src/js/{org.qcobjects.controllers.js → org.qcobjects.controllers.ts} +3 -6
  39. package/src/js/org.qcobjects.effects.d.ts +20 -0
  40. package/src/js/org.qcobjects.effects.ts +430 -0
  41. package/src/js/org.qcobjects.i18n_messages.d.ts +1 -0
  42. package/src/js/{org.qcobjects.i18n_messages.js → org.qcobjects.i18n_messages.ts} +36 -27
  43. package/src/js/org.qcobjects.modal.controllers.d.ts +1 -0
  44. package/src/js/{org.qcobjects.modal.controllers.js → org.qcobjects.modal.controllers.ts} +5 -6
  45. package/src/js/org.qcobjects.modal.effects.d.ts +1 -0
  46. package/src/js/{org.qcobjects.modal.effects.js → org.qcobjects.modal.effects.ts} +4 -1
  47. package/src/js/org.qcobjects.models.d.ts +1 -0
  48. package/src/js/{org.qcobjects.models.js → org.qcobjects.models.ts} +3 -24
  49. package/src/js/org.qcobjects.tools.canvas.d.ts +1 -0
  50. package/src/js/{org.qcobjects.tools.canvas.js → org.qcobjects.tools.canvas.ts} +14 -11
  51. package/src/js/org.qcobjects.tools.d.ts +1 -0
  52. package/src/js/org.qcobjects.tools.layouts.d.ts +1 -0
  53. package/src/js/org.qcobjects.tools.layouts.ts +85 -0
  54. package/src/js/{org.qcobjects.tools.js → org.qcobjects.tools.ts} +19 -11
  55. package/src/js/org.qcobjects.views.d.ts +1 -0
  56. package/src/js/{org.qcobjects.views.js → org.qcobjects.views.ts} +3 -5
  57. package/tsconfig.json +1 -1
  58. package/-m +0 -1
  59. package/src/QCObjects-SDK.js +0 -148
  60. package/src/index.mjs +0 -2
  61. package/src/js/org.qcobjects.cloud.auth.session.usertoken.js +0 -116
  62. package/src/js/org.qcobjects.components.grid.js +0 -65
  63. package/src/js/org.qcobjects.components.js +0 -276
  64. package/src/js/org.qcobjects.components.list.js +0 -59
  65. package/src/js/org.qcobjects.components.notifications.js +0 -190
  66. package/src/js/org.qcobjects.components.splashscreen.js +0 -645
  67. package/src/js/org.qcobjects.controllers.slider.js +0 -154
  68. package/src/js/org.qcobjects.effects.js +0 -345
  69. package/src/js/org.qcobjects.tools.layouts.js +0 -79
  70. /package/{css → src/css}/base-modal.css +0 -0
  71. /package/{css → src/css}/basic-layout-embedded-nav.css +0 -0
  72. /package/{css → src/css}/basic-layout.css +0 -0
  73. /package/{css → src/css}/components/horizontal-list.css +0 -0
  74. /package/{css → src/css}/components/list.css +0 -0
  75. /package/{css → src/css}/components/splashscreen.css +0 -0
  76. /package/{css → src/css}/modal.css +0 -0
  77. /package/src/{index.cjs → index.cts} +0 -0
@@ -0,0 +1,336 @@
1
+ /**
2
+ * QCObjects SDK 2.4
3
+ * ________________
4
+ *
5
+ * Author: Jean Machuca <correojean@gmail.com>
6
+ *
7
+ * Cross Browser Javascript Framework for MVC Patterns
8
+ * QuickCorp/QCObjects is licensed under the
9
+ * GNU Lesser General Public License v3.0
10
+ * [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)
11
+ *
12
+ * Permissions of this copyleft license are conditioned on making available
13
+ * complete source code of licensed works and modifications under the same
14
+ * license or the GNU GPLv3. Copyright and license notices must be preserved.
15
+ * Contributors provide an express grant of patent rights. However, a larger
16
+ * work using the licensed work through interfaces provided by the licensed
17
+ * work may be distributed under different terms and without source code for
18
+ * the larger work.
19
+ *
20
+ * Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
21
+ *
22
+ * Everyone is permitted to copy and distribute verbatim copies of this
23
+ * license document, but changing it is not allowed.
24
+ */
25
+ "use strict";
26
+
27
+ import { Package, Component, logger, _DOMCreateElement, CONFIG, New, ClassFactory, Tag, ComponentURI, QCObjectsElement, ComponentDoneResponse, ComponentParams } from "qcobjects";
28
+ import { ModalFade, ModalMoveDown, ModalMoveUp } from "./org.qcobjects.effects";
29
+ const _top:any = (typeof module === "object" && typeof module.exports === "object") ? (
30
+ module.exports = (typeof globalThis !== "undefined"
31
+ ? globalThis
32
+ : typeof self !== "undefined"
33
+ ? self
34
+ : typeof window !== "undefined"
35
+ ? window
36
+ : typeof global !== "undefined"
37
+ ? global
38
+ : {})
39
+ ) : ((typeof global === "object") ? (global) : (
40
+ (typeof window === "object") ? (window) : ({})
41
+ ));
42
+ (function (global:any) {
43
+
44
+ type FieldComponentParams = ComponentParams & {
45
+ basePath?:string;
46
+ fieldType:string;
47
+ }
48
+ class FormField extends Component {
49
+ fieldType!:string;
50
+ cached = false;
51
+ reload = true;
52
+ constructor (o:FieldComponentParams){
53
+ o.name = (typeof o.name !== "undefined")?(o.name):("form-field");
54
+ super(o);
55
+ }
56
+
57
+ createBindingEvents() {
58
+ let _objList;
59
+ if (typeof this.fieldType === "undefined" || this.fieldType == null) {
60
+ _objList = (this.body as QCObjectsElement).subelements("*[data-field]"); // every child with data-field set
61
+ } else {
62
+ _objList = (this.body as QCObjectsElement).subelements(this.fieldType + "[data-field]"); // every child with data-field set and tagname is equal to fieldType property
63
+ }
64
+ for (let _datak = 0; _datak < _objList.length; _datak++) {
65
+ const _obj = _objList[_datak];
66
+ _obj.addEventListener("change", () => {
67
+ logger.debug("Executing change event binding");
68
+ this.executeBindings();
69
+ });
70
+ _obj.addEventListener("blur", () => {
71
+ logger.debug("Executing change event binding");
72
+ this.executeBindings();
73
+ });
74
+ _obj.addEventListener("focus", () => {
75
+ logger.debug("Executing change event binding");
76
+ this.executeBindings();
77
+ });
78
+ _obj.addEventListener("keydown", () =>{
79
+ logger.debug("Executing keydown event binding");
80
+ this.executeBindings();
81
+ });
82
+ }
83
+ }
84
+
85
+ executeBinding(_obj:HTMLElement & {value:any}) {
86
+ const _datamodel = _obj.getAttribute("data-field");
87
+ logger.debug("Binding " + _datamodel + " for " + this.name);
88
+ this.data[_datamodel as keyof typeof this.data] = _obj.value;
89
+ }
90
+
91
+ executeBindings() {
92
+ let _objList;
93
+ if (typeof this.fieldType === "undefined" || this.fieldType == null) {
94
+ _objList = (this.body as QCObjectsElement).subelements("*[data-field]"); // every child with data-field set
95
+ } else {
96
+ _objList = (this.body as QCObjectsElement).subelements(this.fieldType + "[data-field]"); // every child with data-field set and tagname is equal to fieldType property
97
+ }
98
+ for (let _datak = 0; _datak < _objList.length; _datak++) {
99
+ const _obj = _objList[_datak] as HTMLElement & {value:any};
100
+ const _datamodel = _obj.getAttribute("data-field");
101
+ logger.debug("Binding " + _datamodel + " for " + this.name);
102
+ this.data[_datamodel as keyof typeof this.data] = _obj.value;
103
+ }
104
+ }
105
+
106
+ done(standardResponse:ComponentDoneResponse):Promise<ComponentDoneResponse> {
107
+ const _ret_ = super.done(standardResponse);
108
+ this.executeBindings();
109
+ this.createBindingEvents();
110
+ logger.debug("Field loaded: " + this.fieldType + "[name=" + this.name + "]");
111
+ return _ret_;
112
+ }
113
+
114
+
115
+ }
116
+
117
+ Package("org.qcobjects.base.components", [
118
+ FormField
119
+ ]);
120
+
121
+ class ShadowedComponent extends Component {
122
+ container = null;
123
+ shadowed = true;
124
+ cached = false;
125
+ controller = null;
126
+ view = null;
127
+ data = {};
128
+
129
+ constructor (o:FieldComponentParams){
130
+ o.body = _DOMCreateElement("div") as QCObjectsElement;
131
+ super(o);
132
+ }
133
+
134
+
135
+ }
136
+
137
+ class ButtonField extends FormField {
138
+ constructor(o:FieldComponentParams) {
139
+ o.fieldType = "button";
140
+ super(o);
141
+ }
142
+ }
143
+
144
+ class InputField extends FormField {
145
+ constructor(o:FieldComponentParams) {
146
+ o.fieldType = "input";
147
+ super(o);
148
+ }
149
+
150
+ }
151
+
152
+ class TextField extends FormField {
153
+ constructor(o:FieldComponentParams) {
154
+ o.fieldType = "textarea";
155
+ super(o);
156
+ }
157
+
158
+ }
159
+
160
+ class EmailField extends FormField {
161
+ constructor(o:FieldComponentParams) {
162
+ o.fieldType = "input";
163
+ super(o);
164
+ }
165
+
166
+ }
167
+
168
+ class ModalEnclosureComponent extends Component {
169
+ name = "modalenclosure";
170
+ tplsource = "inline";
171
+ cached = false;
172
+ basePath = CONFIG.get("modalBasePath", CONFIG.get("remoteSDKPath", ""));
173
+ template = `
174
+ <!-- The Modal -->
175
+ <style>
176
+ @import url('https://sdk.qcobjects.dev/css/modal.css');
177
+ </style>
178
+ <div id="modalInstance_{{modalId}}" class="modal">
179
+
180
+ <!-- Modal content -->
181
+ <div class="modal-content">
182
+ <span class="close">&times;</span>
183
+ {{content}}
184
+ </div>
185
+
186
+ </div>
187
+ `;
188
+
189
+ data = {};
190
+ constructor(o:FieldComponentParams) {
191
+ o.body = _DOMCreateElement("div") as QCObjectsElement;
192
+ super(o);
193
+ }
194
+
195
+ }
196
+
197
+ class ModalComponent extends Component {
198
+ name = "modal";
199
+ cached = false;
200
+ modalEnclosureComponentClass = "ModalEnclosureComponent";
201
+ controller = null;
202
+ view = null;
203
+ tplsource = "none";
204
+ closeOnClickOutside = false;
205
+ data = {
206
+ content: "",
207
+ modalId: 0
208
+ };
209
+
210
+ submodal = null;
211
+
212
+ constructor(o:FieldComponentParams) {
213
+ o.basePath = CONFIG.get("modalBasePath", CONFIG.get("remoteSDKPath", ""));
214
+ super(o);
215
+ this.data.modalId = this.__instanceID;
216
+ const submodal = New(ClassFactory(this.modalEnclosureComponentClass), {
217
+ name: this.name,
218
+ basePath: this.basePath,
219
+ data: this.data
220
+ });
221
+ this.subcomponents.push(submodal);
222
+ this.submodal = submodal;
223
+ if (submodal.tplsource === "none") {
224
+ this.body.innerHTML = submodal.parsedAssignmentText;
225
+ } else {
226
+ this.body.append(submodal.body);
227
+ }
228
+
229
+ }
230
+
231
+ modal() {
232
+ const modalId = this.data.modalId;
233
+
234
+ Tag("#modalInstance_" + modalId + ".modal").map( (modal) => {
235
+ modal.style.display = "block";
236
+ return (new ModalFade({})).apply(modal, 0, 1);
237
+ });
238
+ Tag("#modalInstance_" + modalId + ".modal .modal-content").map( (modalcontent) => {
239
+ return (new ModalMoveDown({})).apply(modalcontent, 0, -document.body.clientHeight, 0, 0);
240
+ });
241
+ Tag("#modalInstance_" + modalId + ".modal .modal-content .close").map( (closebtn) => {
242
+ return closebtn.addEventListener("click", () => {
243
+ this.close();
244
+ }, false);
245
+ });
246
+ if (this.closeOnClickOutside) {
247
+ window.addEventListener("click", () => {
248
+ this.close();
249
+ }, false);
250
+ }
251
+ }
252
+
253
+ close() {
254
+ const modalId = this.data.modalId;
255
+ Tag("#modalInstance_" + modalId + ".modal").map( (modal) => {
256
+ modal.style.display = "block";
257
+ return (new ModalFade({})).apply(modal, 1, 0);
258
+ });
259
+ Tag("#modalInstance_" + modalId + ".modal .modal-content").map(function (modalcontent) {
260
+ return (new ModalMoveUp({})).apply(modalcontent, 0, 0, 0, -document.body.clientHeight);
261
+ });
262
+ setTimeout(function () {
263
+ Tag("#modalInstance_" + modalId + ".modal").map((modal) => {
264
+ modal.style.display = "none";
265
+ return true;
266
+ });
267
+ }, 900);
268
+ }
269
+
270
+ rebuild() {
271
+ const _ret_ = super.rebuild();
272
+ this.templateURI = ComponentURI({
273
+ "COMPONENTS_BASE_PATH": CONFIG.get("componentsBasePath", ""),
274
+ "COMPONENT_NAME": "modal",
275
+ "TPLEXTENSION": CONFIG.get("tplextension", ""),
276
+ "TPL_SOURCE": "default" // here is always default in order to get the right uri
277
+ });
278
+ return _ret_; // parent call
279
+ }
280
+
281
+
282
+ }
283
+
284
+ class SwaggerUIComponent extends Component {
285
+ cached = false;
286
+ basePath = CONFIG.get("remoteSDKPath", "");
287
+ tplextension = "tpl.html";
288
+ name = "swagger-ui";
289
+
290
+ }
291
+
292
+
293
+ Package("org.qcobjects.form.components", [
294
+ ShadowedComponent,
295
+ ButtonField,
296
+ InputField,
297
+ TextField,
298
+ EmailField,
299
+ ModalEnclosureComponent,
300
+ ModalComponent,
301
+ SwaggerUIComponent
302
+ ]);
303
+
304
+ global.FormField = FormField;
305
+ global.ShadowedComponent = ShadowedComponent;
306
+ global.ButtonField = ButtonField;
307
+ global.InputField = InputField;
308
+ global.TextField = TextField;
309
+ global.EmailField = EmailField;
310
+ global.ModalEnclosureComponent = ModalEnclosureComponent;
311
+ global.ModalComponent = ModalComponent;
312
+ global.SwaggerUIComponent = SwaggerUIComponent;
313
+
314
+ })(_top);
315
+
316
+ const FormField = _top.FormField;
317
+ const ShadowedComponent = _top.ShadowedComponent;
318
+ const ButtonField = _top.ButtonField;
319
+ const InputField = _top.InputField;
320
+ const TextField = _top.TextField;
321
+ const EmailField = _top.EmailField;
322
+ const ModalEnclosureComponent = _top.ModalEnclosureComponent;
323
+ const ModalComponent = _top.ModalComponent;
324
+ const SwaggerUIComponent = _top.SwaggerUIComponent;
325
+
326
+ export {
327
+ FormField,
328
+ ShadowedComponent,
329
+ ButtonField,
330
+ InputField,
331
+ TextField,
332
+ EmailField,
333
+ ModalComponent,
334
+ ModalEnclosureComponent,
335
+ SwaggerUIComponent
336
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,6 @@
1
+ import { Package, Controller, serviceLoader, New, ClassFactory, logger, _DOMCreateElement, Tag, QCObjectsElement, ControllerParams } from "qcobjects";
2
+ import { FormField, ModalComponent } from "./org.qcobjects.components";
3
+
1
4
  /**
2
5
  * QCObjects SDK 2.4
3
6
  * ________________
@@ -28,13 +31,13 @@ Package("org.qcobjects.controllers.form",[
28
31
 
29
32
  class FormValidations extends Controller {
30
33
  getDefault (){
31
- return function (fieldName, dataValue, element){
32
- var _regex = {
34
+ return function (fieldName:string, dataValue:any, element:HTMLElement){
35
+ const _regex = {
33
36
  name:"^[a-zA-Z]+(([',. -][a-zA-Z ])?[a-zA-Z]*)*$",
34
37
  email:"^([A-Za-z0-9]+)@([A-Za-z0-9]+).([A-Za-z0-9]+)$"
35
38
  };
36
- var _pattern_ = (element.getAttribute("pattern") || _regex[fieldName]);
37
- var pattern = new RegExp(_pattern_);
39
+ const _pattern_ = (element.getAttribute("pattern") || _regex[fieldName as keyof typeof _regex]);
40
+ const pattern = new RegExp(_pattern_);
38
41
  return pattern.test(dataValue);
39
42
  };
40
43
  }
@@ -42,8 +45,8 @@ Package("org.qcobjects.controllers.form",[
42
45
  },
43
46
 
44
47
  class FormController extends Controller {
45
- dependencies=[];
46
- component=null;
48
+ validations:any[]=[];
49
+ formValidatorModal:typeof ModalComponent;
47
50
  serviceClass="";
48
51
  formSettings={
49
52
  backRouting:"#",
@@ -51,48 +54,45 @@ Package("org.qcobjects.controllers.form",[
51
54
  nextRouting:"#signupsuccessful"
52
55
  };
53
56
 
54
- hasValidation (element){
55
- var controller = this;
56
- var fieldName = element.getAttribute("data-field");
57
- var _hasValidation = false;
58
- if (typeof controller.validations !== "undefined"
59
- && controller.validations.hasOwnProperty.call(controller.validations,fieldName)){
57
+ hasValidation (element:HTMLElement){
58
+ const fieldName = element.getAttribute("data-field") as string;
59
+ let _hasValidation = false;
60
+ if (typeof this.validations !== "undefined"
61
+ && Object.hasOwnProperty.call(this.validations,fieldName)){
60
62
  _hasValidation = true;
61
63
  }
62
64
  return _hasValidation;
63
65
  }
64
66
 
65
- isInvalid (element){
66
- var controller = this;
67
- var _isInvalid = false;
68
- var fieldName = element.getAttribute("data-field");
69
- var dataValue = this.component.data[fieldName];
67
+ isInvalid (element:HTMLElement){
68
+ let _isInvalid = false;
69
+ const fieldName = element.getAttribute("data-field");
70
+ const dataValue = this.component.data[fieldName as string];
70
71
 
71
- var _execValidation = function (fieldName, dataValue, element){
72
- return (typeof controller.validations !== "undefined"
73
- && controller.validations.hasOwnProperty.call(controller.validations,fieldName)
74
- && controller.validations[fieldName].call(controller).call(controller,fieldName,dataValue, element));
72
+ const _execValidation = (fieldName:string, dataValue:any, element:HTMLElement) => {
73
+ return (typeof this.validations !== "undefined"
74
+ && Object.hasOwnProperty.call(this.validations,fieldName as string)
75
+ && this.validations[fieldName as keyof typeof this.validations].call(null,fieldName,dataValue, element));
75
76
  };
76
77
 
77
78
  if (typeof this.validations !== "undefined" && (
78
- !_execValidation(fieldName, dataValue, element)
79
+ !_execValidation(fieldName as string, dataValue, element)
79
80
  )){
80
81
  _isInvalid = true;
81
82
  }
82
83
  return _isInvalid;
83
84
  }
84
85
 
85
- isValid (element){
86
+ isValid (element:HTMLElement){
86
87
  return !this.isInvalid(element);
87
88
  }
88
89
 
89
90
  save (){
90
- var controller = this;
91
- if (controller.serviceClass !== ""){
92
- location.href=controller.formSettings.loadingRouting;
93
- serviceLoader(New(ClassFactory(controller.serviceClass),{
94
- data:controller.component.data
95
- })).then(
91
+ if (this.serviceClass !== ""){
92
+ location.href=this.formSettings.loadingRouting;
93
+ serviceLoader(New(ClassFactory(this.serviceClass),{
94
+ data:this.component.data
95
+ }), false).then(
96
96
  (successfulResponse)=>{
97
97
  // This will show the service response as a plain text
98
98
  console.log("DONE SERVICE COMPONENT");
@@ -101,12 +101,12 @@ Package("org.qcobjects.controllers.form",[
101
101
  }catch (e){
102
102
  // no json
103
103
  }
104
- location.href=controller.formSettings.nextRouting;
104
+ location.href=this.formSettings.nextRouting;
105
105
 
106
106
  },
107
107
  (failedResponse)=>{
108
108
  logger.debug(failedResponse);
109
- location.href=controller.formSettings.backRouting;
109
+ location.href=this.formSettings.backRouting;
110
110
  });
111
111
  } else {
112
112
  logger.debug("No service name declared on serviceClass property");
@@ -116,19 +116,18 @@ Package("org.qcobjects.controllers.form",[
116
116
 
117
117
  formSaveTouchHandler (){
118
118
  logger.debug("Saving data...");
119
- var controller = this;
120
- var _componentRoot_ = (controller.component.shadowed)?(controller.component.shadowRoot.host):(controller.component.body);
121
- controller.component.executeBindings();
122
- if (controller.formValidatorModal!=null){
123
- var componentElementFields = _componentRoot_.subelements("*[data-field]");
124
- var fieldsToValidate = componentElementFields.filter(
125
- f => controller.hasValidation.call(controller,f)
119
+ const _componentRoot_ = (this.component.shadowed)?((this.component?.shadowRoot as ShadowRoot).host):(this.component.body);
120
+ (this.component as typeof FormField).executeBindings();
121
+ if (this.formValidatorModal!=null){
122
+ const componentElementFields = (_componentRoot_ as QCObjectsElement).subelements("*[data-field]");
123
+ const fieldsToValidate = componentElementFields.filter(
124
+ f => this.hasValidation(f)
126
125
  );
127
126
 
128
- var _labelledby = function (parentElement, element){
129
- var _arialabelledby = function (parentElement, element){
130
- return (element.getAttribute("aria-labelledby") !== null)?(element.getAttribute("aria-labelledby").split(" ").map(
131
- e => parentElement.subelements(`#${e}`).map(_e => _e.innerHTML)
127
+ const _labelledby = function (parentElement:HTMLElement, element:HTMLElement){
128
+ const _arialabelledby = (parentElement:HTMLElement, element:HTMLElement) => {
129
+ return (element.getAttribute("aria-labelledby") !== null)?((element.getAttribute("aria-labelledby") || "").split(" ").map(
130
+ e => (parentElement as QCObjectsElement).subelements(`#${e}`).map(_e => _e.innerHTML)
132
131
  ).join(" ")):(null);
133
132
  };
134
133
 
@@ -139,35 +138,35 @@ Package("org.qcobjects.controllers.form",[
139
138
  || element.getAttribute("data-field") );
140
139
  };
141
140
 
142
- var _ariatitle = function (element){
141
+ const _ariatitle = function (element:HTMLElement){
143
142
  return (element.getAttribute("title") || element.getAttribute("aria-title") || "");
144
143
  };
145
144
 
146
- var invalidFields = fieldsToValidate.filter(f=>controller.isInvalid(f));
145
+ const invalidFields = fieldsToValidate.filter(f=>this.isInvalid(f));
147
146
  if (invalidFields.length>0){
148
- var validationMessage = `
147
+ const validationMessage = `
149
148
  <details>
150
149
  <summary>Please verify the following incorrect fields:</summary>
151
150
  <ul>
152
151
  <div>
153
- ${invalidFields.map(element => "<li><div>"+_labelledby(_componentRoot_,element)+"</div><div>"+_ariatitle(element)+"</div></li>").join("")}
152
+ ${invalidFields.map(element => "<li><div>"+_labelledby(_componentRoot_ as HTMLElement,element)+"</div><div>"+_ariatitle(element)+"</div></li>").join("")}
154
153
  </div>
155
154
  </ul>
156
155
  </details>
157
156
  `;
158
- controller.formValidatorModal.body.subelements(".validationMessage")[0].innerHTML=validationMessage;
159
- controller.formValidatorModal.modal();
157
+ this.formValidatorModal.body.subelements(".validationMessage")[0].innerHTML=validationMessage;
158
+ this.formValidatorModal.modal();
160
159
  } else {
161
- controller.save();
160
+ this.save();
162
161
  }
163
162
  } else {
164
163
  logger.debug("Unable to find the modal validator...");
165
164
  logger.debug("Saving data...");
166
- controller.save();
165
+ this.save();
167
166
  }
168
167
  }
169
168
 
170
- constructor (o){
169
+ constructor (o:ControllerParams){
171
170
  super(o);
172
171
  this.component = o.component;
173
172
  this.component = this.component.Cast(FormField);
@@ -175,12 +174,11 @@ Package("org.qcobjects.controllers.form",[
175
174
 
176
175
  done (){
177
176
  logger.debugEnabled=true;
178
- var controller=this;
179
177
  try {
180
- controller.component.createBindingEvents();
181
- var modalBody = _DOMCreateElement("div");
178
+ (this.component as typeof FormField).createBindingEvents();
179
+ const modalBody = _DOMCreateElement("div");
182
180
  modalBody.className="modal_body";
183
- controller.formValidatorModal = New(ModalComponent,{
181
+ this.formValidatorModal = New(ModalComponent,{
184
182
  body:modalBody,
185
183
  subcomponents:[],
186
184
  data:{
@@ -189,13 +187,13 @@ Package("org.qcobjects.controllers.form",[
189
187
  });
190
188
 
191
189
  Tag(".modal_body").map(e=>document.body.removeChild(e));
192
- document.body.append(controller.formValidatorModal);
190
+ document.body.append(this.formValidatorModal);
193
191
 
194
192
  } catch (e){
195
193
  logger.debug("Unable to create the modal");
196
194
  }
197
- controller.onpress(".submit",function (){
198
- controller.formSaveTouchHandler();
195
+ this.onpress(".submit", () => {
196
+ this.formSaveTouchHandler();
199
197
  });
200
198
 
201
199
  }
@@ -205,4 +203,4 @@ Package("org.qcobjects.controllers.form",[
205
203
 
206
204
  ]);
207
205
 
208
- }).call(null);
206
+ })();
@@ -0,0 +1 @@
1
+ export {};