qcobjects 2.4.30-beta → 2.4.32-beta

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 (3) hide show
  1. package/QCObjects.js +1496 -1375
  2. package/VERSION +1 -1
  3. package/package.json +1 -1
package/QCObjects.js CHANGED
@@ -27,17 +27,17 @@
27
27
  /*eslint no-empty: "off"*/
28
28
  /*eslint strict: "off"*/
29
29
  /*eslint no-mixed-operators: "off"*/
30
- (function(_top) {
30
+ (function (_top) {
31
31
  "use strict";
32
32
  var global = _top;
33
33
  _top.global = global;
34
34
 
35
- var _protected_code_ = function(_) {
36
- var __oldtoString = (typeof _.prototype !== "undefined") ? (_.prototype.toString) : (function() {
35
+ var _protected_code_ = function (_) {
36
+ var __oldtoString = (typeof _.prototype !== "undefined") ? (_.prototype.toString) : (function () {
37
37
  return "";
38
38
  });
39
39
  if (typeof _.prototype !== "undefined") {
40
- _.prototype.toString = function() {
40
+ _.prototype.toString = function () {
41
41
  var _protected_symbols = ["ComplexStorageCache",
42
42
  "css",
43
43
  "append",
@@ -99,7 +99,7 @@
99
99
  }
100
100
  };
101
101
  (_protected_code_)(Function);
102
- var _methods_ = function(_) {
102
+ var _methods_ = function (_) {
103
103
  var _m = [];
104
104
  for (var i in _) {
105
105
  if ((typeof _[i]).toLowerCase() === "function") {
@@ -110,23 +110,23 @@
110
110
  };
111
111
 
112
112
  String.prototype.__mAll__ = function (regex) {
113
- // This is an alternative to old browsers that dont support String.prototype.matchAll
114
- // https://github.com/tc39/proposal-string-matchall
115
- var matches = [];
116
- this.replace(regex, function () {
117
- var match = Array.prototype.slice.call(arguments, 0, -2);
118
- match.input = arguments[arguments.length - 1];
119
- match.index = arguments[arguments.length - 2];
120
- matches.push(match);
121
- });
122
- return matches;
113
+ // This is an alternative to old browsers that dont support String.prototype.matchAll
114
+ // https://github.com/tc39/proposal-string-matchall
115
+ var matches = [];
116
+ this.replace(regex, function () {
117
+ var match = Array.prototype.slice.call(arguments, 0, -2);
118
+ match.input = arguments[arguments.length - 1];
119
+ match.index = arguments[arguments.length - 2];
120
+ matches.push(match);
121
+ });
122
+ return matches;
123
123
  };
124
- if (typeof String.prototype.matchAll === "undefined"){
125
- String.prototype.matchAll = String.prototype.__mAll__;
124
+ if (typeof String.prototype.matchAll === "undefined") {
125
+ String.prototype.matchAll = String.prototype.__mAll__;
126
126
  }
127
127
  var isDeno = (typeof window !== "undefined" && "Deno" in window);
128
128
  var isBrowser = (typeof window !== "undefined" && typeof window.self !== "undefined" && window === window.self) && !isDeno;
129
- var _DOMCreateElement = function(elementName) {
129
+ var _DOMCreateElement = function (elementName) {
130
130
  var _ret_;
131
131
  if (isBrowser) {
132
132
  _ret_ = document.createElement(elementName);
@@ -140,11 +140,11 @@
140
140
  const fs = require("fs");
141
141
  }
142
142
 
143
- var _DataStringify = function(data) {
144
- var getCircularReplacer = function() {
143
+ var _DataStringify = function (data) {
144
+ var getCircularReplacer = function () {
145
145
  var seen = new WeakSet();
146
146
  var _level = 0;
147
- return function(key, value) {
147
+ return function (key, value) {
148
148
  if (typeof value === "object" && value !== null) {
149
149
  if (seen.has(value)) {
150
150
  _level += 1;
@@ -165,7 +165,7 @@
165
165
  Element.prototype.subelements = _subelements;
166
166
  HTMLDocument.prototype.subelements = _subelements;
167
167
  HTMLElement.prototype.subelements = _subelements;
168
- if (typeof ShadowRoot !== "undefined"){
168
+ if (typeof ShadowRoot !== "undefined") {
169
169
  ShadowRoot.prototype.subelements = _subelements;
170
170
  }
171
171
  }
@@ -191,7 +191,7 @@
191
191
  _top = global;
192
192
  }
193
193
  var basePath = (
194
- function() {
194
+ function () {
195
195
  var _basePath = "";
196
196
  if (isBrowser) {
197
197
  var baseURI = _top.document.baseURI.split("?")[0].split("/");
@@ -218,14 +218,14 @@
218
218
  * Polyfilling Promise
219
219
  */
220
220
  if (!("Promise" in _top)) {
221
- _top.Promise = function(_f) {
221
+ _top.Promise = function (_f) {
222
222
  var _p = {
223
- then () {},
223
+ then() {},
224
224
  catch () {},
225
- _then (response) {
225
+ _then(response) {
226
226
  this.then.call(_p, response);
227
227
  },
228
- _catch (response) {
228
+ _catch(response) {
229
229
  this.catch.call(_p, response);
230
230
  }
231
231
  };
@@ -234,18 +234,18 @@
234
234
  };
235
235
  }
236
236
  if (typeof _top.console === "undefined") {
237
- _top.console = function() {};
238
- _top.console.prototype.log = function(message) {};
237
+ _top.console = function () {};
238
+ _top.console.prototype.log = function (message) {};
239
239
  }
240
240
 
241
241
  var domain = (
242
- function() {
242
+ function () {
243
243
  return (typeof document !== "undefined" && document.domain !== "") ? (document.domain) : ("localhost");
244
244
  }
245
245
  )();
246
246
 
247
247
  var _secretKey = (
248
- function() {
248
+ function () {
249
249
  var __secretKey = _top[(![] + [])[((+!+[]) + (+!+[]))] + (typeof ![])[(+!+[])] + (typeof [])[((+!+[]) + (+!+[])) * ((+!+[]) + (+!+[]))] + (![] + [])[(+!+[])] + (!![] + [])[(+[])] + ([] + [] + [][
250
250
  []
251
251
  ])[(+[+!+[] + [+[]]]) / ((+!+[]) + (+!+[]))] + (typeof ![])[(+!+[])] + ([] + [] + [][
@@ -255,7 +255,7 @@
255
255
  }
256
256
  )();
257
257
  var is_phonegap = (
258
- function() {
258
+ function () {
259
259
  return (typeof cordova !== "undefined") ? (true) : (false);
260
260
  }
261
261
  )();
@@ -268,11 +268,11 @@
268
268
  }
269
269
 
270
270
  _top._asyncLoad = [];
271
- var asyncLoad = function(callback, args) {
271
+ var asyncLoad = function (callback, args) {
272
272
  var asyncCallback = {
273
273
  "func": callback,
274
274
  "args": args,
275
- "dispatch" () {
275
+ "dispatch"() {
276
276
  this.func.apply(null, this.args);
277
277
  }
278
278
  };
@@ -281,34 +281,34 @@
281
281
  };
282
282
 
283
283
  if (isBrowser) {
284
- var _fireAsyncLoad = function() {
284
+ var _fireAsyncLoad = function () {
285
285
  if (document.readyState === "complete") {
286
- _top._asyncLoad.map(function (fc){
286
+ _top._asyncLoad.map(function (fc) {
287
287
  fc.dispatch.call(fc);
288
288
  });
289
289
  }
290
290
  };
291
291
  document.onreadystatechange = _fireAsyncLoad;
292
292
  } else if (typeof _top.global !== "undefined") {
293
- _top.global._fireAsyncLoad = function() {
294
- _top._asyncLoad.map(function (fc){
293
+ _top.global._fireAsyncLoad = function () {
294
+ _top._asyncLoad.map(function (fc) {
295
295
  fc.dispatch.call(fc);
296
296
  });
297
297
  };
298
298
  }
299
299
 
300
300
  _top.asyncLoad = asyncLoad;
301
- var Logger = function() {
301
+ var Logger = function () {
302
302
  return {
303
303
  debugEnabled: true,
304
304
  infoEnabled: true,
305
305
  warnEnabled: true,
306
- debug (message) {
306
+ debug(message) {
307
307
  if (this.debugEnabled) {
308
- console.log("\x1b[35m%s\x1b[0m","[DEBUG] " + message);
308
+ console.log("\x1b[35m%s\x1b[0m", "[DEBUG] " + message);
309
309
  }
310
310
  },
311
- info (message) {
311
+ info(message) {
312
312
  var color;
313
313
  if (this.infoEnabled) {
314
314
  if (isBrowser) {
@@ -316,12 +316,12 @@
316
316
  } else {
317
317
  color = "\x1b[33m%s\x1b[0m";
318
318
  }
319
- console.info(color,"[INFO] " + message);
319
+ console.info(color, "[INFO] " + message);
320
320
  }
321
321
  },
322
- warn (message) {
322
+ warn(message) {
323
323
  if (this.warnEnabled) {
324
- console.warn("\x1b[31m%s\x1b[0m","[WARN] " + message);
324
+ console.warn("\x1b[31m%s\x1b[0m", "[WARN] " + message);
325
325
  }
326
326
  }
327
327
  };
@@ -332,7 +332,7 @@
332
332
  _top.logger = logger;
333
333
  var Base64 = {
334
334
  _keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
335
- encode (e) {
335
+ encode(e) {
336
336
  var t = "";
337
337
  var n, r, i, s, o, u, a;
338
338
  var f = 0;
@@ -354,7 +354,7 @@
354
354
  }
355
355
  return t;
356
356
  },
357
- decode (e) {
357
+ decode(e) {
358
358
  var t = "";
359
359
  var n, r, i;
360
360
  var s, o, u, a;
@@ -379,7 +379,7 @@
379
379
  t = Base64._utf8_decode(t);
380
380
  return t;
381
381
  },
382
- _utf8_encode (e) {
382
+ _utf8_encode(e) {
383
383
  e = e.replace(/rn/g, "n");
384
384
  var t = "";
385
385
  for (var n = 0; n < e.length; n++) {
@@ -397,7 +397,7 @@
397
397
  }
398
398
  return t;
399
399
  },
400
- _utf8_decode (e) {
400
+ _utf8_decode(e) {
401
401
  var t = "";
402
402
  var n = 0;
403
403
  var r = 0;
@@ -423,11 +423,11 @@
423
423
  return t;
424
424
  }
425
425
  };
426
- var waitUntil = function(func, exp) {
427
- var _waitUntil = function(func, exp) {
426
+ var waitUntil = function (func, exp) {
427
+ var _waitUntil = function (func, exp) {
428
428
  var maxWaitCycles = 2000;
429
429
  var _w = 0;
430
- var _t = setInterval(function() {
430
+ var _t = setInterval(function () {
431
431
  if (exp.call()) {
432
432
  clearInterval(_t);
433
433
  func.call();
@@ -443,26 +443,26 @@
443
443
  }
444
444
  }, 1);
445
445
  };
446
- setTimeout(function() {
446
+ setTimeout(function () {
447
447
  _waitUntil(func, exp);
448
448
  }, 1);
449
449
  };
450
- if (typeof localStorage === "undefined"){
450
+ if (typeof localStorage === "undefined") {
451
451
  /* Polyfill for localStorage */
452
452
  var localStorage = {
453
- getItem (name) {
454
- return (Object.hasOwnProperty.call(this, name))?(this[name]):(null);
453
+ getItem(name) {
454
+ return (Object.hasOwnProperty.call(this, name)) ? (this[name]) : (null);
455
455
  },
456
- setItem (name, value) {
456
+ setItem(name, value) {
457
457
  this[name] = value;
458
458
  },
459
- removeItem (name) {
459
+ removeItem(name) {
460
460
  delete this[name];
461
461
  }
462
462
  };
463
463
  /* end Polyfill for localStorage */
464
464
  }
465
- var ComplexStorageCache = function(params) {
465
+ var ComplexStorageCache = function (params) {
466
466
  var object, load, alternate;
467
467
  object = params.index;
468
468
  if (typeof object !== "undefined") {
@@ -486,13 +486,13 @@
486
486
  });
487
487
  logger.debug("RESPONSE OF {{cachedObjectID}} IS ALREADY CACHED ".replace("{{cachedObjectID}}", cachedObjectID));
488
488
  }
489
-
489
+
490
490
  } else {
491
491
  throw new Error("ComplexStorageCache: index is undefined");
492
492
  }
493
493
  return this;
494
494
  };
495
- ComplexStorageCache.prototype.getItem = function(cachedObjectID) {
495
+ ComplexStorageCache.prototype.getItem = function (cachedObjectID) {
496
496
  var retrievedObject = localStorage.getItem(cachedObjectID);
497
497
  if (!this.isEmpty(retrievedObject)) {
498
498
  return JSON.parse(retrievedObject);
@@ -500,10 +500,10 @@
500
500
  return null;
501
501
  }
502
502
  };
503
- ComplexStorageCache.prototype.setItem = function(cachedObjectID, value) {
503
+ ComplexStorageCache.prototype.setItem = function (cachedObjectID, value) {
504
504
  localStorage.setItem(cachedObjectID, _DataStringify(value));
505
505
  };
506
- ComplexStorageCache.prototype.isEmpty = function(object) {
506
+ ComplexStorageCache.prototype.isEmpty = function (object) {
507
507
  var r = false;
508
508
  switch (true) {
509
509
  case (typeof object === "undefined"):
@@ -518,24 +518,28 @@
518
518
  }
519
519
  return r;
520
520
  };
521
- ComplexStorageCache.prototype.getID = function(object) {
521
+ ComplexStorageCache.prototype.getID = function (object) {
522
522
  var cachedObjectID;
523
523
  if (typeof object !== "undefined") {
524
524
  cachedObjectID = "cachedObject_" + Base64.encode(_DataStringify(object).replace(/\{|\}|,/g, "_"));
525
525
  }
526
526
  return cachedObjectID;
527
527
  };
528
- ComplexStorageCache.prototype.save = function(object, cachedNewResponse) {
528
+ ComplexStorageCache.prototype.save = function (object, cachedNewResponse) {
529
529
  var cachedObjectID = this.getID(object);
530
530
  logger.debug("CACHING THE RESPONSE OF {{cachedObjectID}} ".replace("{{cachedObjectID}}", cachedObjectID));
531
531
  this.setItem(cachedObjectID, cachedNewResponse);
532
532
  };
533
- ComplexStorageCache.prototype.getCached = function(object) {
533
+ ComplexStorageCache.prototype.getCached = function (object) {
534
534
  var cachedObjectID = this.getID(object);
535
535
  return this.getItem(cachedObjectID);
536
536
  };
537
- ComplexStorageCache.prototype.clear = function() {
538
- Object.keys(localStorage).filter ( function (k) {return k.startsWith("cachedObject_");} ).map ( function (c) {localStorage.removeItem(c);});
537
+ ComplexStorageCache.prototype.clear = function () {
538
+ Object.keys(localStorage).filter(function (k) {
539
+ return k.startsWith("cachedObject_");
540
+ }).map(function (c) {
541
+ localStorage.removeItem(c);
542
+ });
539
543
  };
540
544
 
541
545
  /**
@@ -549,7 +553,7 @@
549
553
  var supportsPassive = false;
550
554
  try {
551
555
  var opts = Object.defineProperty({}, "passive", {
552
- get () {
556
+ get() {
553
557
  supportsPassive = true;
554
558
  return supportsPassive;
555
559
  }
@@ -557,7 +561,7 @@
557
561
  window.addEventListener("testPassive", null, opts);
558
562
  window.removeEventListener("testPassive", null, opts);
559
563
  } catch (e) {}
560
- var captureFalse = function() {
564
+ var captureFalse = function () {
561
565
  return (supportsPassive) ? ({
562
566
  passive: true
563
567
  }) : (false);
@@ -572,18 +576,18 @@
572
576
  /**
573
577
  * Basic Type of all elements
574
578
  */
575
- if (isBrowser){
576
- Element.prototype.find = function(tag) {
577
- var _oo = [];
578
- var _tags = document.subelements(tag);
579
- _tags.map(function (_tt,_t){
580
- if ((typeof _tags[_t] !== "undefined") && _tags[_t].parentNode.tagName === this.parentNode.tagName) {
581
- _oo.push(_Cast(_tt, (new Object())));
582
- }
583
- });
584
- return _oo;
585
- };
586
- }
579
+ if (isBrowser) {
580
+ Element.prototype.find = function (tag) {
581
+ var _oo = [];
582
+ var _tags = document.subelements(tag);
583
+ _tags.map(function (_tt, _t) {
584
+ if ((typeof _tags[_t] !== "undefined") && _tags[_t].parentNode.tagName === this.parentNode.tagName) {
585
+ _oo.push(_Cast(_tt, (new Object())));
586
+ }
587
+ });
588
+ return _oo;
589
+ };
590
+ }
587
591
 
588
592
  /**
589
593
  * Primary instance ID of all objects
@@ -591,22 +595,22 @@
591
595
  var __instanceID;
592
596
  // Adaptation of Production steps of ECMA-262, Edition 5, 15.2.3.5
593
597
  // Reference: http://es5.github.io/#x15.2.3.5
594
- var _Object_Create = (function() {
598
+ var _Object_Create = (function () {
595
599
 
596
600
  // make a safe reference to Object.prototype.hasOwnProperty
597
601
  var hasOwn = Object.prototype.hasOwnProperty;
598
602
 
599
- return function(O) {
603
+ return function (O) {
600
604
  // 1. If Type(O) is not Object or Null throw a TypeError exception.
601
605
  if (typeof O !== "object") {
602
- throw TypeError("Object prototype may only be an Object or null. The type is " + typeof(O));
606
+ throw TypeError("Object prototype may only be an Object or null. The type is " + typeof (O));
603
607
  }
604
608
 
605
609
  // 2. Let obj be the result of creating a new object as if by the
606
610
  // expression new Object() where Object is the standard built-in
607
611
  // constructor with that name
608
612
  // 3. Set the [[Prototype]] internal property of obj to O.
609
- var QCObjects = function() {};
613
+ var QCObjects = function () {};
610
614
  QCObjects.prototype = O;
611
615
  var obj = new QCObjects();
612
616
 
@@ -664,10 +668,10 @@
664
668
  }
665
669
 
666
670
  var __is_raw_class__ = function (o_c) {
667
- return (typeof o_c === "function" && o_c.toString().startsWith("class"))?(true):(false);
671
+ return (typeof o_c === "function" && o_c.toString().startsWith("class")) ? (true) : (false);
668
672
  };
669
673
 
670
- var _LegacyCopy = function(obj) {
674
+ var _LegacyCopy = function (obj) {
671
675
  var _value_;
672
676
  switch (true) {
673
677
  case typeof obj === "string":
@@ -702,17 +706,17 @@
702
706
  *
703
707
  * @param Object or function
704
708
  */
705
- var ObjectName = function(o) {
706
- var ret = "";
707
- if (typeof o === "function" && Object.hasOwnProperty.call(o, "name") && o.name !== "") {
708
- ret = o.name;
709
- } else if (typeof o !== "undefined" && typeof o.constructor === "function" && o.constructor.name !== "") {
710
- ret = o.constructor.name;
711
- } else if (typeof o !== "undefined" && typeof o.constructor === "object") {
712
- ret = o.constructor.toString().replace(/\[(.*?)\]/g, "$1").split(" ").slice(1).join("");
713
- }
714
- return ret;
715
- };
709
+ var ObjectName = function (o) {
710
+ var ret = "";
711
+ if (typeof o === "function" && Object.hasOwnProperty.call(o, "name") && o.name !== "") {
712
+ ret = o.name;
713
+ } else if (typeof o !== "undefined" && typeof o.constructor === "function" && o.constructor.name !== "") {
714
+ ret = o.constructor.name;
715
+ } else if (typeof o !== "undefined" && typeof o.constructor === "object") {
716
+ ret = o.constructor.toString().replace(/\[(.*?)\]/g, "$1").split(" ").slice(1).join("");
717
+ }
718
+ return ret;
719
+ };
716
720
 
717
721
  /**
718
722
  * Casts an object to another object class type
@@ -720,7 +724,7 @@
720
724
  * @param {Object} obj_source
721
725
  * @param {Object} obj_dest
722
726
  */
723
- var _Cast = function(obj_source, obj_dest) {
727
+ var _Cast = function (obj_source, obj_dest) {
724
728
  for (var v in obj_source) {
725
729
  if (typeof obj_source[v] !== "undefined") {
726
730
  try {
@@ -739,7 +743,7 @@
739
743
  * @param {Object} obj_source
740
744
  * @param {Object} obj_dest
741
745
  */
742
- var _CastProps = function(obj_source, obj_dest) {
746
+ var _CastProps = function (obj_source, obj_dest) {
743
747
  for (var v in obj_source) {
744
748
  if (typeof obj_source[v] !== "undefined" && typeof obj_source[v] !== "function") {
745
749
  try {
@@ -747,7 +751,7 @@
747
751
  } catch (e) {
748
752
  // DO NOTHING
749
753
  }
750
- } else if (typeof obj_source[v] === "function"){
754
+ } else if (typeof obj_source[v] === "function") {
751
755
  try {
752
756
  obj_dest[v] = obj_source[v].bind(obj_dest);
753
757
  } catch (e) {
@@ -766,22 +770,22 @@
766
770
  * @param {Object} type
767
771
  * @param {Object} definition
768
772
  */
769
- var __is__forbidden_name__ = function (){
770
- return (["__proto__", "prototype", "Object", "Map", "defineProperty", "indexOf", "toString", "__instanceID"].indexOf(arguments[0])!== -1)?(true):(false);
773
+ var __is__forbidden_name__ = function () {
774
+ return (["__proto__", "prototype", "Object", "Map", "defineProperty", "indexOf", "toString", "__instanceID"].indexOf(arguments[0]) !== -1) ? (true) : (false);
771
775
  };
772
776
 
773
777
  /**
774
- * Determine the type of the Object for any QCObjects Object
775
- *
776
- * @param {Object} object
777
- */
778
+ * Determine the type of the Object for any QCObjects Object
779
+ *
780
+ * @param {Object} object
781
+ */
778
782
  var __getType__ = function __getType__(o_c) {
779
783
  var _ret_ = "";
780
784
  switch (true) {
781
- case typeof o_c === "object"
782
- && !!o_c.constructor
783
- && Object.hasOwnProperty.call(o_c.constructor, "name")
784
- && o_c.constructor.name !== "":
785
+ case typeof o_c === "object" &&
786
+ !!o_c.constructor &&
787
+ Object.hasOwnProperty.call(o_c.constructor, "name") &&
788
+ o_c.constructor.name !== "":
785
789
  _ret_ = o_c.constructor.name;
786
790
  break;
787
791
  case (!!o_c && !!o_c.__classType) && o_c.__classType !== "":
@@ -798,16 +802,16 @@
798
802
  };
799
803
 
800
804
  /**
801
- * Returns if a class or object is from a determinated type
802
- * @param {Object} object
803
- * @param {String} typeName
804
- */
805
+ * Returns if a class or object is from a determinated type
806
+ * @param {Object} object
807
+ * @param {String} typeName
808
+ */
805
809
  var is_a = function is_a(obj, typeName) {
806
810
  return (typeof obj !== "undefined" && obj !== null &&
807
- (((isQCObjects_Class(obj) || isQCObjects_Object(obj)) && (obj.hierarchy().includes(typeName)))
808
- || __getType__(obj) === typeName
809
- || ObjectName(obj) === typeName
810
- || typeof obj === typeName))?(true):(false);
811
+ (((isQCObjects_Class(obj) || isQCObjects_Object(obj)) && (obj.hierarchy().includes(typeName))) ||
812
+ __getType__(obj) === typeName ||
813
+ ObjectName(obj) === typeName ||
814
+ typeof obj === typeName)) ? (true) : (false);
811
815
  };
812
816
 
813
817
 
@@ -819,7 +823,7 @@
819
823
  window[f.name] = f;
820
824
  } catch (e) {}
821
825
  } else if (typeof global !== "undefined") {
822
- if (!Object.hasOwnProperty.call(global,f.name)) {
826
+ if (!Object.hasOwnProperty.call(global, f.name)) {
823
827
  global[f.name] = f;
824
828
  }
825
829
  }
@@ -832,12 +836,12 @@
832
836
  _QC_CLASSES[name] = _class_;
833
837
  _top[name] = _QC_CLASSES[name];
834
838
  return _top[name];
835
- }
839
+ };
836
840
 
837
841
  var RegisterClass = function (_class_) {
838
842
  return __register_class__(_class_);
839
- }
840
- __make_global__ (RegisterClass);
843
+ };
844
+ __make_global__(RegisterClass);
841
845
 
842
846
  /**
843
847
  * Creates new object class of another object
@@ -876,7 +880,7 @@
876
880
  throw new Error("Class type must be a function or class");
877
881
  }
878
882
 
879
- if (__is__forbidden_name__.call(this, name)){
883
+ if (__is__forbidden_name__.call(this, name)) {
880
884
  throw new Error(`${name} is not an allowed word in the name of a class`);
881
885
  }
882
886
 
@@ -891,36 +895,42 @@
891
895
  } else {
892
896
  definition = _LegacyCopy(definition);
893
897
  }
894
-
898
+
895
899
  /* hack to prevent duplicate __instanceID */
896
900
  if (typeof definition["__instanceID"] !== "undefined") {
897
901
  delete definition["__instanceID"];
898
- }
902
+ }
899
903
 
900
904
  _QC_CLASSES[name] = class extends _types_[type.name] {
901
905
  __classType = name;
902
- __definition = {...definition};
906
+ __definition = {
907
+ ...definition
908
+ };
903
909
  body = null;
904
910
 
905
911
  static hierarchy(__class__) {
906
- var __classType = function(o_c) {
907
- return (Object.hasOwnProperty.call(o_c,"__classType"))?(o_c.__classType):(__getType__.call(__class__, o_c));
908
- };
909
- var __hierarchy__proto__ = (c) => { return (typeof c !== "undefined" && typeof c.__proto__ !== "undefined" && c.__proto__ !== null)?( ( (__classType(c)!== "") ?([__classType(c)]):([])).concat( __hierarchy__proto__(c.__proto__) ) ):([]); };
910
-
911
- if (typeof __class__ === "undefined" || __class__ === null) {
912
- __class__ = this;
913
- }
914
- var __hierarchy = [];
915
- __hierarchy.push(__classType(__class__));
916
- __hierarchy = __hierarchy.concat(__hierarchy__proto__(__class__.__proto__));
917
- return __hierarchy;
912
+ var __classType = function (o_c) {
913
+ return (Object.hasOwnProperty.call(o_c, "__classType")) ? (o_c.__classType) : (__getType__.call(__class__, o_c));
914
+ };
915
+ var __hierarchy__proto__ = (c) => {
916
+ return (typeof c !== "undefined" && typeof c.__proto__ !== "undefined" && c.__proto__ !== null) ? (((__classType(c) !== "") ? ([__classType(c)]) : ([])).concat(__hierarchy__proto__(c.__proto__))) : ([]);
917
+ };
918
+
919
+ if (typeof __class__ === "undefined" || __class__ === null) {
920
+ __class__ = this;
921
+ }
922
+ var __hierarchy = [];
923
+ __hierarchy.push(__classType(__class__));
924
+ __hierarchy = __hierarchy.concat(__hierarchy__proto__(__class__.__proto__));
925
+ return __hierarchy;
918
926
  }
919
927
 
920
- constructor () {
928
+ constructor() {
921
929
  var _o_;
922
930
  if (arguments.length > 0) {
923
- _o_ = {...arguments[0]};
931
+ _o_ = {
932
+ ...arguments[0]
933
+ };
924
934
  } else {
925
935
  _o_ = {};
926
936
  }
@@ -935,9 +945,9 @@
935
945
  }
936
946
 
937
947
  if (typeof self.__definition !== "undefined") {
938
- Object.keys(self.__definition).filter(function (k){
939
- return isNaN(k) && !["name","__instanceID", "__classType", "__definition"].includes(k);
940
- }).forEach(function(key) {
948
+ Object.keys(self.__definition).filter(function (k) {
949
+ return isNaN(k) && !["name", "__instanceID", "__classType", "__definition"].includes(k);
950
+ }).forEach(function (key) {
941
951
  if (typeof self.__definition[key] === "function") {
942
952
  self[key] = self.__definition[key].bind(self);
943
953
  } else {
@@ -945,54 +955,57 @@
945
955
  }
946
956
  });
947
957
  }
948
- _methods_(_QC_CLASSES[self.__classType]).map (function(m) {
949
- self[m.name] = m.bind(self); });
950
- _methods_(self.__definition).map (function(m) { self[m.name] = m.bind(self); });
958
+ _methods_(_QC_CLASSES[self.__classType]).map(function (m) {
959
+ self[m.name] = m.bind(self);
960
+ });
961
+ _methods_(self.__definition).map(function (m) {
962
+ self[m.name] = m.bind(self);
963
+ });
951
964
 
952
- if (typeof self.__definition === "undefined" || (!Object.hasOwnProperty.call(self.__definition,"body")) || typeof self.__definition.body === "undefined") {
965
+ if (typeof self.__definition === "undefined" || (!Object.hasOwnProperty.call(self.__definition, "body")) || typeof self.__definition.body === "undefined") {
953
966
  try {
954
967
  if (isBrowser) {
955
- self["body"] = _DOMCreateElement(self.__definition.__classType);
968
+ self["body"] = _DOMCreateElement(self.__definition.__classType);
956
969
  } else {
957
970
  self["body"] = {};
958
971
  }
959
972
  } catch (e) {
960
973
  self["body"] = {};
961
974
  }
962
- } else if (Object.hasOwnProperty.call(self.__definition,"body")) {
975
+ } else if (Object.hasOwnProperty.call(self.__definition, "body")) {
963
976
  self["body"] = self.__definition.body;
964
977
  }
965
978
 
966
979
  try {
967
980
  if (typeof self.__new__ === "function") {
968
- self.__new__.call(self,_o_);
981
+ self.__new__.call(self, _o_);
969
982
  } else if (typeof super.__new__ === "function") {
970
983
  self.__new__ = super.__new__.bind(self);
971
- self.__new__.call(self,_o_);
984
+ self.__new__.call(self, _o_);
972
985
  }
973
- if (typeof self === "object" && Object.hasOwnProperty.call(self,"_new_") && typeof self._new_.isCalled === "undefined") {
986
+ if (typeof self === "object" && Object.hasOwnProperty.call(self, "_new_") && typeof self._new_.isCalled === "undefined") {
974
987
  try {
975
- self._new_.call(self,_o_);
988
+ self._new_.call(self, _o_);
976
989
  self._new_.isCalled = true;
977
- }catch (e){
990
+ } catch (e) {
978
991
  logger.warn(`${self.__classType}._new_() failed with error: ${e}`);
979
992
  }
980
993
  }
981
- } catch (e){
994
+ } catch (e) {
982
995
  logger.warn(e);
983
996
  }
984
997
  }
985
998
 
986
- __new__ (_o_) {
987
- _CastProps(_o_, this);
999
+ __new__(_o_) {
1000
+ _CastProps(_o_, this);
988
1001
  }
989
- _new_ (){}
1002
+ _new_() {}
990
1003
 
991
- getClass () {
1004
+ getClass() {
992
1005
  return Object.getPrototypeOf(this.constructor);
993
1006
  }
994
1007
 
995
- css (_css) {
1008
+ css(_css) {
996
1009
  if (typeof this["body"] !== "undefined" && this["body"]["style"] !== "undefined") {
997
1010
  logger.debug("body style");
998
1011
  this["body"]["style"] = _Cast(_css, this["body"]["style"]);
@@ -1000,7 +1013,7 @@
1000
1013
  return this["body"]["style"];
1001
1014
  }
1002
1015
 
1003
- hierarchy (__instance__) {
1016
+ hierarchy(__instance__) {
1004
1017
  var __hierarchy;
1005
1018
  if (typeof __instance__ === "undefined" || __instance__ === null) {
1006
1019
  __instance__ = this;
@@ -1011,13 +1024,15 @@
1011
1024
  } else {
1012
1025
  __hierarchy = [];
1013
1026
  }
1014
- return [__getType__(__instance__)].concat(__hierarchy).filter(function (value, index, self) { return self.indexOf(value) === index;});
1027
+ return [__getType__(__instance__)].concat(__hierarchy).filter(function (value, index, self) {
1028
+ return self.indexOf(value) === index;
1029
+ });
1015
1030
  }
1016
1031
 
1017
1032
 
1018
- append (child) {
1033
+ append(child) {
1019
1034
  logger.debug("append: start");
1020
- if (is_a(child, "Component")){
1035
+ if (is_a(child, "Component")) {
1021
1036
  logger.debug("append: child is a Component");
1022
1037
  logger.debug(`appending the body of ${child.name}`);
1023
1038
  }
@@ -1040,7 +1055,7 @@
1040
1055
  }
1041
1056
  }
1042
1057
 
1043
- attachIn (tag) {
1058
+ attachIn(tag) {
1044
1059
  if (isBrowser) {
1045
1060
  var tags = document.subelements(tag);
1046
1061
  for (var i = 0, j = tags.length; i < j; i++) {
@@ -1059,16 +1074,16 @@
1059
1074
  _QC_CLASSES[name]["__definition"] = definition;
1060
1075
  _QC_CLASSES[name]["__definition"]["hierarchy"] = _QC_CLASSES[name]["hierarchy"].bind(_QC_CLASSES[name]["__definition"]);
1061
1076
  _QC_CLASSES[name]["__definition"]["__classType"] = name;
1062
- _QC_CLASSES[name]["__definition"]["__new__"] = function __new__ (_o_) {
1077
+ _QC_CLASSES[name]["__definition"]["__new__"] = function __new__(_o_) {
1063
1078
  _CastProps(_o_, this);
1064
1079
  };
1065
1080
 
1066
1081
  _top[name] = _QC_CLASSES[name];
1067
-
1082
+
1068
1083
  return _top[name];
1069
1084
  };
1070
1085
 
1071
- Class.prototype.toString = function() {
1086
+ Class.prototype.toString = function () {
1072
1087
  return "Class(name, type, definition) { [QCObjects native code] }";
1073
1088
  };
1074
1089
 
@@ -1078,22 +1093,23 @@
1078
1093
  * @param {String} name
1079
1094
  */
1080
1095
 
1081
- var ClassFactory = function(className) {
1096
+ var ClassFactory = function (className) {
1082
1097
  var _classFactory;
1083
- if (className !== null && className.indexOf(".")>-1){
1084
- var packageName = className.split(".").slice(0,className.split(".").length-1).join(".");
1098
+ if (className !== null && className.indexOf(".") > -1) {
1099
+ var packageName = className.split(".").slice(0, className.split(".").length - 1).join(".");
1085
1100
  var _className = className.split(".").slice(-1).join("");
1086
1101
  var _package = Package(packageName);
1087
- var packageClasses = (typeof _package !== "undefined")?(_package.filter(classFactory=>{
1088
- return typeof classFactory !== "undefined"
1089
- && Object.hasOwnProperty.call(classFactory,"__definition")
1090
- && isQCObjects_Class(classFactory)
1091
- && classFactory.__definition.__classType===_className
1092
- && !Object.hasOwnProperty.call(classFactory, "__instanceID");}).reverse()):([]);
1093
- if (packageClasses.length>0){
1102
+ var packageClasses = (typeof _package !== "undefined") ? (_package.filter(classFactory => {
1103
+ return typeof classFactory !== "undefined" &&
1104
+ Object.hasOwnProperty.call(classFactory, "__definition") &&
1105
+ isQCObjects_Class(classFactory) &&
1106
+ classFactory.__definition.__classType === _className &&
1107
+ !Object.hasOwnProperty.call(classFactory, "__instanceID");
1108
+ }).reverse()) : ([]);
1109
+ if (packageClasses.length > 0) {
1094
1110
  _classFactory = packageClasses[0];
1095
1111
  }
1096
- } else if (className !== null && Object.hasOwnProperty.call(_QC_CLASSES,className)) {
1112
+ } else if (className !== null && Object.hasOwnProperty.call(_QC_CLASSES, className)) {
1097
1113
  _classFactory = _QC_CLASSES[className];
1098
1114
  }
1099
1115
  return _classFactory;
@@ -1109,29 +1125,29 @@
1109
1125
  };
1110
1126
 
1111
1127
  /**
1112
- * A replacement for direct using of innerHTML
1113
- * use: [element].render('content') where 'content' is the string corresponding
1114
- * to the DOM to insert in the element
1115
- **/
1128
+ * A replacement for direct using of innerHTML
1129
+ * use: [element].render('content') where 'content' is the string corresponding
1130
+ * to the DOM to insert in the element
1131
+ **/
1116
1132
  Element.prototype.render = function QC_Render(content) {
1117
1133
  var _self = this;
1118
- var _appendVDOM = function (_self,content){
1119
- if (typeof document.implementation.createHTMLDocument !== "undefined"){
1134
+ var _appendVDOM = function (_self, content) {
1135
+ if (typeof document.implementation.createHTMLDocument !== "undefined") {
1120
1136
  var doc = document.implementation.createHTMLDocument("");
1121
1137
  doc.innerHTML = content;
1122
- doc.body.subelements("*").map(function (element){
1138
+ doc.body.subelements("*").map(function (element) {
1123
1139
  return _self.append(element);
1124
1140
  });
1125
1141
  }
1126
1142
  };
1127
- if (typeof this.innerHTML !== "undefined"){
1143
+ if (typeof this.innerHTML !== "undefined") {
1128
1144
  try {
1129
1145
  this.innerHTML += content;
1130
- }catch (e){
1131
- _appendVDOM(_self,content);
1146
+ } catch (e) {
1147
+ _appendVDOM(_self, content);
1132
1148
  }
1133
1149
  } else {
1134
- _appendVDOM(_self,content);
1150
+ _appendVDOM(_self, content);
1135
1151
  }
1136
1152
  };
1137
1153
  }
@@ -1145,10 +1161,10 @@
1145
1161
  * @param {String} classMethodName
1146
1162
  * @param {Object} params
1147
1163
  */
1148
- var _super_ = function(className, classMethodName, params) {
1164
+ var _super_ = function (className, classMethodName, params) {
1149
1165
  return ClassFactory(className)[classMethodName];
1150
1166
  };
1151
- _super_.prototype.toString = function() {
1167
+ _super_.prototype.toString = function () {
1152
1168
  return "_super_(className,classMethodName,params) { [QCObjects native code] }";
1153
1169
  };
1154
1170
 
@@ -1159,12 +1175,12 @@
1159
1175
  * @param {Object} args
1160
1176
  */
1161
1177
 
1162
- var New = function(__class__, args) {
1178
+ var New = function (__class__, args) {
1163
1179
  args = (arguments.length > 1) ? (args) : ({});
1164
1180
  return (typeof __class__ === "undefined") ? (new Object()) : (new __class__(args));
1165
1181
  };
1166
1182
 
1167
- New.prototype.toString = function() {
1183
+ New.prototype.toString = function () {
1168
1184
  return "New(QCObjectsClassName, args) { [QCObjects native code] }";
1169
1185
  };
1170
1186
 
@@ -1172,12 +1188,12 @@
1172
1188
  var Export = function (f) {
1173
1189
  return __make_global__(f);
1174
1190
  };
1175
- Export.prototype.toString = function() {
1191
+ Export.prototype.toString = function () {
1176
1192
  return "Export(function or symbol) { [QCObjects native code] }";
1177
1193
  };
1178
1194
 
1179
1195
  if (!isBrowser) {
1180
- var findPackageNodePath = function(packagename) {
1196
+ var findPackageNodePath = function (packagename) {
1181
1197
  const fs = require("fs");
1182
1198
  var sdkPath = null;
1183
1199
  try {
@@ -1202,7 +1218,7 @@
1202
1218
  sdkPath = sdkPaths[0];
1203
1219
  logger.info(packagename + " is Installed.");
1204
1220
  } else {
1205
- // logger.debug(packagename + ' is not in a standard path.');
1221
+ // logger.debug(packagename + ' is not in a standard path.');
1206
1222
  }
1207
1223
  } catch (e) {
1208
1224
  // do nothing
@@ -1217,16 +1233,16 @@
1217
1233
  last_string: "",
1218
1234
  last_key: "",
1219
1235
  construct: false,
1220
- _new_ (o) {
1236
+ _new_(o) {
1221
1237
  var string = o["string"];
1222
- var key = (o.hasOwnProperty.call(o,"key")) ? (o["key"]) : (null);
1238
+ var key = (o.hasOwnProperty.call(o, "key")) ? (o["key"]) : (null);
1223
1239
  this.__new__(o);
1224
1240
  key = (key === null) ? (this.__instanceID) : (key);
1225
1241
  this.last_key = key;
1226
1242
  this.last_string = string;
1227
1243
  this.construct = true;
1228
1244
  },
1229
- _encrypt () {
1245
+ _encrypt() {
1230
1246
  var string = this.string;
1231
1247
  var key = this.key;
1232
1248
  var result = "";
@@ -1241,7 +1257,7 @@
1241
1257
  this.last_string = Base64.encode(result);
1242
1258
  return this.last_string;
1243
1259
  },
1244
- _decrypt () {
1260
+ _decrypt() {
1245
1261
  var string = this.string;
1246
1262
  var key = this.key;
1247
1263
  var result = "";
@@ -1258,86 +1274,88 @@
1258
1274
  this.last_string = result;
1259
1275
  return this.last_string;
1260
1276
  },
1261
- encrypt (string, key) {
1277
+ encrypt(string, key) {
1262
1278
  var crypt = New(ClassFactory("_Crypt"), {
1263
1279
  string: string,
1264
- key: (key !== "")?(key):("12345678ABC")
1280
+ key: (key !== "") ? (key) : ("12345678ABC")
1265
1281
  });
1266
1282
  return crypt._encrypt();
1267
1283
  },
1268
- decrypt (string, key) {
1284
+ decrypt(string, key) {
1269
1285
  var crypt = New(ClassFactory("_Crypt"), {
1270
1286
  string: string,
1271
- key: (key !== "")?(key):("12345678ABC")
1287
+ key: (key !== "") ? (key) : ("12345678ABC")
1272
1288
  });
1273
1289
  return crypt._decrypt();
1274
1290
  }
1275
1291
  });
1276
1292
 
1277
- var _CryptObject = function(o) {
1293
+ var _CryptObject = function (o) {
1278
1294
  return ClassFactory("_Crypt").encrypt(_DataStringify(o), _secretKey);
1279
1295
  };
1280
- var _DecryptObject = function(s) {
1281
- return (s === "")?({}):(JSON.parse(ClassFactory("_Crypt").decrypt(s, _secretKey)));
1296
+ var _DecryptObject = function (s) {
1297
+ return (s === "") ? ({}) : (JSON.parse(ClassFactory("_Crypt").decrypt(s, _secretKey)));
1282
1298
  };
1283
1299
 
1284
1300
  var shortCode = function () {
1285
1301
  var length = 1000;
1286
- var code1 = ClassFactory("_Crypt").encrypt((Math.random()*length).toString().replace(".", ""), (new Date()).getTime().toString());
1287
- var code2 = ClassFactory("_Crypt").encrypt((Math.random()*length).toString().replace(".", ""), (new Date((new Date()).getTime() - 1000*1000)).getTime().toString());
1288
- var shortCode = code2.list().map((o1, index)=> {return code1.list()[index] === o1 ? null: o1;}).filter(c=>c!==null).join("");
1302
+ var code1 = ClassFactory("_Crypt").encrypt((Math.random() * length).toString().replace(".", ""), (new Date()).getTime().toString());
1303
+ var code2 = ClassFactory("_Crypt").encrypt((Math.random() * length).toString().replace(".", ""), (new Date((new Date()).getTime() - 1000 * 1000)).getTime().toString());
1304
+ var shortCode = code2.list().map((o1, index) => {
1305
+ return code1.list()[index] === o1 ? null : o1;
1306
+ }).filter(c => c !== null).join("");
1289
1307
  return shortCode;
1290
1308
  };
1291
1309
  var uniqueId = shortCode;
1292
1310
 
1293
1311
  Class("Processor", {
1294
1312
  processors: {
1295
- "config" (arg){
1296
- return _top.CONFIG.get(arg,"");
1313
+ "config"(arg) {
1314
+ return _top.CONFIG.get(arg, "");
1297
1315
  },
1298
- "ENV" (arg) {
1299
- return (typeof process !== "undefined")?(process.env[arg]):("");
1316
+ "ENV"(arg) {
1317
+ return (typeof process !== "undefined") ? (process.env[arg]) : ("");
1300
1318
  },
1301
- "global" (arg){
1302
- return (typeof global !== "undefined")?(global[arg]):("");
1319
+ "global"(arg) {
1320
+ return (typeof global !== "undefined") ? (global[arg]) : ("");
1303
1321
  }
1304
1322
  },
1305
- setProcessor (_proc_){
1306
- if (typeof _proc_ === "function" && _proc_.name !== ""){
1323
+ setProcessor(_proc_) {
1324
+ if (typeof _proc_ === "function" && _proc_.name !== "") {
1307
1325
  this.processors[_proc_.name] = _proc_;
1308
1326
  }
1309
1327
  },
1310
- execute (processorName, args){
1328
+ execute(processorName, args) {
1311
1329
  let processorHandler = this;
1312
1330
  return processorHandler.processors[processorName].apply(processorHandler, args.split(","));
1313
1331
  },
1314
- process (template) {
1315
- if (typeof template === "string"){
1332
+ process(template) {
1333
+ if (typeof template === "string") {
1316
1334
  let processorHandler = this;
1317
- Object.keys(processorHandler.processors).map(function (funcName){
1318
- [...template.matchAll(new RegExp("\\$"+funcName+"\\((.*)\\).*","g"))].map(
1319
- function (procesorMatch){
1335
+ Object.keys(processorHandler.processors).map(function (funcName) {
1336
+ [...template.matchAll(new RegExp("\\$" + funcName + "\\((.*)\\).*", "g"))].map(
1337
+ function (procesorMatch) {
1320
1338
  var match0 = `$${funcName}(${procesorMatch[1]})`;
1321
- template = template.replace(match0,processorHandler.execute.call(processorHandler, funcName, procesorMatch[1]));
1339
+ template = template.replace(match0, processorHandler.execute.call(processorHandler, funcName, procesorMatch[1]));
1322
1340
  }
1323
1341
  );
1324
1342
  });
1325
1343
  }
1326
1344
  return template;
1327
1345
  },
1328
- processObject (obj){
1346
+ processObject(obj) {
1329
1347
  let __instance__ = this;
1330
- if (typeof obj === "object"){
1348
+ if (typeof obj === "object") {
1331
1349
  Object.keys(obj).map(
1332
- function (_k){
1333
- if (typeof obj[_k] === "object" && !obj[_k].hasOwnProperty.call(obj[_k],"call")){
1350
+ function (_k) {
1351
+ if (typeof obj[_k] === "object" && !obj[_k].hasOwnProperty.call(obj[_k], "call")) {
1334
1352
  obj[_k] = __instance__.processObject(obj[_k]);
1335
- } else if (typeof obj[_k] === "string"){
1353
+ } else if (typeof obj[_k] === "string") {
1336
1354
  obj[_k] = __instance__.process(obj[_k]);
1337
1355
  }
1338
1356
  }
1339
1357
  );
1340
- } else if (typeof obj === "string"){
1358
+ } else if (typeof obj === "string") {
1341
1359
  obj = __instance__.process(obj);
1342
1360
  }
1343
1361
  return obj;
@@ -1345,52 +1363,52 @@
1345
1363
  });
1346
1364
 
1347
1365
  class ConfigSettings {
1348
- static _instance = null;
1349
- static _CONFIG_ENC = null;
1350
- static get instance() {
1351
-
1352
- if (this._instance === null) {
1353
- var _config_settings = new ConfigSettings();
1354
- _config_settings._CONFIG = {
1355
- "relativeImportPath": "",
1356
- "remoteImportsPath": "",
1357
- "remoteSDKPath": "https://sdk.qcobjects.dev/v2.4/",
1358
- "asynchronousImportsLoad": false,
1359
- "removePackageScriptAfterLoading":true,
1360
- "componentsBasePath": "",
1361
- "delayForReady": 0,
1362
- "preserveComponentBodyTag": false,
1363
- "overrideComponentTag": false,
1364
- "useConfigService": false,
1365
- "routingWay": "hash",
1366
- "useSDK": true,
1367
- "useLocalSDK": false,
1368
- "basePath": basePath
1369
- };
1370
- _config_settings._CONFIG_ENC = null;
1371
- this._instance = _config_settings;
1372
- }
1373
-
1374
- return this._instance;
1366
+ static _instance = null;
1367
+ static _CONFIG_ENC = null;
1368
+ static get instance() {
1369
+
1370
+ if (this._instance === null) {
1371
+ var _config_settings = new ConfigSettings();
1372
+ _config_settings._CONFIG = {
1373
+ "relativeImportPath": "",
1374
+ "remoteImportsPath": "",
1375
+ "remoteSDKPath": "https://sdk.qcobjects.dev/v2.4/",
1376
+ "asynchronousImportsLoad": false,
1377
+ "removePackageScriptAfterLoading": true,
1378
+ "componentsBasePath": "",
1379
+ "delayForReady": 0,
1380
+ "preserveComponentBodyTag": false,
1381
+ "overrideComponentTag": false,
1382
+ "useConfigService": false,
1383
+ "routingWay": "hash",
1384
+ "useSDK": true,
1385
+ "useLocalSDK": false,
1386
+ "basePath": basePath
1387
+ };
1388
+ _config_settings._CONFIG_ENC = null;
1389
+ this._instance = _config_settings;
1375
1390
  }
1376
1391
 
1377
- static set instance(value) {
1378
- this._instance = value;
1379
- }
1392
+ return this._instance;
1393
+ }
1394
+
1395
+ static set instance(value) {
1396
+ this._instance = value;
1397
+ }
1380
1398
  }
1381
1399
  _QC_CLASSES["ConfigSettings"] = ConfigSettings;
1382
1400
 
1383
1401
  Class("CONFIG", Object, {
1384
1402
 
1385
- get _CONFIG_ENC () {
1403
+ get _CONFIG_ENC() {
1386
1404
  return ClassFactory("ConfigSettings").instance._CONFIG_ENC;
1387
1405
  },
1388
1406
 
1389
- get _CONFIG () {
1407
+ get _CONFIG() {
1390
1408
  return ClassFactory("ConfigSettings").instance._CONFIG;
1391
1409
  },
1392
1410
 
1393
- set (name, value) {
1411
+ set(name, value) {
1394
1412
  logger.debug(`CONFIG.set ${name}: ${value}`);
1395
1413
  // hack to force update basePath from CONFIG
1396
1414
  if (name === "basePath") {
@@ -1399,8 +1417,8 @@
1399
1417
  var _conf;
1400
1418
  try {
1401
1419
  _conf = (
1402
- function(config) {
1403
- if (config._CONFIG_ENC === null){
1420
+ function (config) {
1421
+ if (config._CONFIG_ENC === null) {
1404
1422
  config._CONFIG_ENC = ClassFactory("_Crypt").encrypt(_DataStringify({}), _secretKey);
1405
1423
  }
1406
1424
  var _protectedEnc = config._CONFIG_ENC.valueOf();
@@ -1410,22 +1428,22 @@
1410
1428
  )(ClassFactory("ConfigSettings").instance);
1411
1429
  } catch (e) {
1412
1430
  _conf = {};
1413
- console.error (e);
1431
+ console.error(e);
1414
1432
  logger.debug("failed to encrypt config");
1415
1433
  }
1416
1434
 
1417
1435
  _conf[name] = value;
1418
1436
  ClassFactory("ConfigSettings").instance._CONFIG_ENC = _CryptObject(_conf);
1419
- if (Object.hasOwnProperty.call(ClassFactory("ConfigSettings").instance, "_CONFIG") && Object.hasOwnProperty.call(ClassFactory("ConfigSettings").instance._CONFIG,name)) {
1437
+ if (Object.hasOwnProperty.call(ClassFactory("ConfigSettings").instance, "_CONFIG") && Object.hasOwnProperty.call(ClassFactory("ConfigSettings").instance._CONFIG, name)) {
1420
1438
  ClassFactory("ConfigSettings").instance._CONFIG[name] = value;
1421
1439
  }
1422
1440
  },
1423
- get (name,_default) {
1441
+ get(name, _default) {
1424
1442
  var _value;
1425
1443
  try {
1426
1444
  var _conf = (
1427
- function(config) {
1428
- if (config._CONFIG_ENC === null){
1445
+ function (config) {
1446
+ if (config._CONFIG_ENC === null) {
1429
1447
  config._CONFIG_ENC = ClassFactory("_Crypt").encrypt(_DataStringify({}), _secretKey);
1430
1448
  }
1431
1449
  var _protectedEnc = config._CONFIG_ENC.valueOf();
@@ -1433,21 +1451,21 @@
1433
1451
  return _CastProps(_protectedConf, _DecryptObject(_protectedEnc));
1434
1452
  }
1435
1453
  )(ClassFactory("ConfigSettings").instance);
1436
- if (typeof _conf[name] !== "undefined"){
1454
+ if (typeof _conf[name] !== "undefined") {
1437
1455
  _value = _conf[name];
1438
- } else if (typeof _default !== "undefined"){
1456
+ } else if (typeof _default !== "undefined") {
1439
1457
  _value = _default;
1440
1458
  }
1441
- } catch (e){
1442
- console.error (e);
1459
+ } catch (e) {
1460
+ console.error(e);
1443
1461
  logger.debug("Something wrong when trying to get CONFIG values");
1444
- logger.debug("No config value for: "+name);
1462
+ logger.debug("No config value for: " + name);
1445
1463
  _value = _default;
1446
1464
  }
1447
- return ClassFactory("Processor").processObject.call(ClassFactory("Processor"),_value);
1465
+ return ClassFactory("Processor").processObject.call(ClassFactory("Processor"), _value);
1448
1466
  }
1449
1467
  });
1450
-
1468
+
1451
1469
  Export(waitUntil);
1452
1470
  Export(_super_);
1453
1471
  Export(ComplexStorageCache);
@@ -1457,22 +1475,22 @@
1457
1475
  Export(__getType__);
1458
1476
  Export(is_a);
1459
1477
 
1460
- var isQCObjects_Object = function (_){
1461
- return (typeof _ === "object"
1462
- && Object.hasOwnProperty.call(_,"__classType")
1463
- && (!!_.__instanceID)
1464
- && Object.hasOwnProperty.call(_,"__definition")
1465
- && typeof _.__definition !== "undefined"
1466
- )?(true):(false);
1478
+ var isQCObjects_Object = function (_) {
1479
+ return (typeof _ === "object" &&
1480
+ Object.hasOwnProperty.call(_, "__classType") &&
1481
+ (!!_.__instanceID) &&
1482
+ Object.hasOwnProperty.call(_, "__definition") &&
1483
+ typeof _.__definition !== "undefined"
1484
+ ) ? (true) : (false);
1467
1485
  };
1468
1486
 
1469
- var isQCObjects_Class = function (_){
1470
- return (typeof _ === "function"
1471
- && (!_.__instanceID)
1472
- && (!!_.__definition)
1473
- && typeof _.__definition !== "undefined"
1474
- && !!_.__definition.__classType
1475
- )?(true):(false);
1487
+ var isQCObjects_Class = function (_) {
1488
+ return (typeof _ === "function" &&
1489
+ (!_.__instanceID) &&
1490
+ (!!_.__definition) &&
1491
+ typeof _.__definition !== "undefined" &&
1492
+ !!_.__definition.__classType
1493
+ ) ? (true) : (false);
1476
1494
  };
1477
1495
 
1478
1496
  /**
@@ -1481,30 +1499,30 @@
1481
1499
  * @param {Object} namespace
1482
1500
  * @param {Object} classes
1483
1501
  */
1484
- var Package = function(namespace, classes) {
1485
- if (_QC_PACKAGES.hasOwnProperty.call(_QC_PACKAGES,namespace) &&
1502
+ var Package = function (namespace, classes) {
1503
+ if (_QC_PACKAGES.hasOwnProperty.call(_QC_PACKAGES, namespace) &&
1486
1504
  typeof _QC_PACKAGES[namespace] !== "undefined" &&
1487
- _QC_PACKAGES[namespace].hasOwnProperty.call(_QC_PACKAGES[namespace],"length") &&
1505
+ _QC_PACKAGES[namespace].hasOwnProperty.call(_QC_PACKAGES[namespace], "length") &&
1488
1506
  _QC_PACKAGES[namespace].length > 0 &&
1489
1507
  typeof classes !== "undefined" &&
1490
- classes.hasOwnProperty.call(classes,"length") &&
1508
+ classes.hasOwnProperty.call(classes, "length") &&
1491
1509
  classes.length > 0
1492
1510
  ) {
1493
- classes.filter(
1494
- function (_c1){
1495
- return isQCObjects_Class(_c1);
1496
- }
1497
- ).map(function (_class_){
1498
- _class_.__definition.__namespace = namespace;
1499
- });
1511
+ classes.filter(
1512
+ function (_c1) {
1513
+ return isQCObjects_Class(_c1);
1514
+ }
1515
+ ).map(function (_class_) {
1516
+ _class_.__definition.__namespace = namespace;
1517
+ });
1500
1518
  _QC_PACKAGES[namespace] = _QC_PACKAGES[namespace].concat(classes);
1501
- } else if (typeof classes !== "undefined"){
1502
- if (typeof classes === "object" && classes.hasOwnProperty.call(classes,"length")){
1519
+ } else if (typeof classes !== "undefined") {
1520
+ if (typeof classes === "object" && classes.hasOwnProperty.call(classes, "length")) {
1503
1521
  classes.filter(
1504
- function (_c1){
1522
+ function (_c1) {
1505
1523
  return isQCObjects_Class(_c1);
1506
1524
  }
1507
- ).map(function (_class_){
1525
+ ).map(function (_class_) {
1508
1526
  _class_.__definition.__namespace = namespace;
1509
1527
  });
1510
1528
  } else if (isQCObjects_Class(classes)) {
@@ -1512,27 +1530,38 @@
1512
1530
  }
1513
1531
  _QC_PACKAGES[namespace] = classes;
1514
1532
  }
1515
- if (Object.hasOwnProperty.call(_QC_PACKAGES,namespace)){
1516
- _QC_PACKAGES[namespace].map(function (_class_){
1533
+ if (Object.hasOwnProperty.call(_QC_PACKAGES, namespace)) {
1534
+ _QC_PACKAGES[namespace].map(function (_class_) {
1517
1535
  __register_class__(_class_);
1518
1536
  });
1519
1537
  }
1520
- return (Object.hasOwnProperty.call(_QC_PACKAGES,namespace))?(_QC_PACKAGES[namespace]):(undefined);
1538
+ return (Object.hasOwnProperty.call(_QC_PACKAGES, namespace)) ? (_QC_PACKAGES[namespace]) : (undefined);
1521
1539
  };
1522
- Package.prototype.toString = function() {
1540
+ Package.prototype.toString = function () {
1523
1541
  return "Package(namespace, classes) { [QCObjects native code] }";
1524
1542
  };
1525
1543
 
1526
1544
  /**
1527
- * Declare Namespace
1528
- *
1529
- * @param {String} packageName
1530
- * @param {Object} package
1531
- */
1532
- var NamespaceRef = function (namespace){
1545
+ * Declare Namespace
1546
+ *
1547
+ * @param {String} packageName
1548
+ * @param {Object} package
1549
+ */
1550
+ var NamespaceRef = function (namespace) {
1533
1551
  let packageInstance = Package(namespace);
1534
- let classes = packageInstance.filter(c=>isQCObjects_Class(c)).map(c=>{return {[c.__definition.__classType]:c};}).reduce ((a, b)=> Object.assign(a, b));
1535
- return namespace.split(".").map(c=>{return {[c]:classes};}).reverse().reduce ( (a, b) => {b[Object.keys(b)]=a;return b;} );
1552
+ let classes = packageInstance.filter(c => isQCObjects_Class(c)).map(c => {
1553
+ return {
1554
+ [c.__definition.__classType]: c
1555
+ };
1556
+ }).reduce((a, b) => Object.assign(a, b));
1557
+ return namespace.split(".").map(c => {
1558
+ return {
1559
+ [c]: classes
1560
+ };
1561
+ }).reverse().reduce((a, b) => {
1562
+ b[Object.keys(b)] = a;
1563
+ return b;
1564
+ });
1536
1565
  };
1537
1566
 
1538
1567
 
@@ -1543,9 +1572,9 @@
1543
1572
  * @param {Object} ready
1544
1573
  * @param {Boolean} external
1545
1574
  */
1546
- var Import = function() {
1575
+ var Import = function () {
1547
1576
  var packagename;
1548
- var ready = function() {};
1577
+ var ready = function () {};
1549
1578
  var external = false;
1550
1579
  if (arguments.length < 1) {
1551
1580
  return;
@@ -1567,9 +1596,9 @@
1567
1596
  }
1568
1597
  var _promise_import_;
1569
1598
  if (isBrowser) {
1570
- _promise_import_ = new Promise(function(resolve, reject) {
1599
+ _promise_import_ = new Promise(function (resolve, reject) {
1571
1600
 
1572
- var allPackagesImported = function() {
1601
+ var allPackagesImported = function () {
1573
1602
  var ret = false;
1574
1603
  var cp = 0;
1575
1604
  for (var p in _QC_PACKAGES) {
@@ -1583,14 +1612,14 @@
1583
1612
  return ret;
1584
1613
  };
1585
1614
 
1586
- var readyImported = function(e) {
1615
+ var readyImported = function (e) {
1587
1616
  _QC_PACKAGES_IMPORTED.push(ready);
1588
1617
  if (allPackagesImported()) {
1589
- _QC_PACKAGES_IMPORTED.map(function (_imported_){
1618
+ _QC_PACKAGES_IMPORTED.map(function (_imported_) {
1590
1619
  _QC_READY_LISTENERS.push(_imported_);
1591
1620
  });
1592
1621
  }
1593
- if (isBrowser && _top.CONFIG.get("removePackageScriptAfterLoading")){
1622
+ if (isBrowser && _top.CONFIG.get("removePackageScriptAfterLoading")) {
1594
1623
  e.target.remove();
1595
1624
  }
1596
1625
  resolve.call(_promise_import_, {
@@ -1599,17 +1628,17 @@
1599
1628
  });
1600
1629
  };
1601
1630
 
1602
- if (!_QC_PACKAGES.hasOwnProperty.call(_QC_PACKAGES,packagename)) {
1631
+ if (!_QC_PACKAGES.hasOwnProperty.call(_QC_PACKAGES, packagename)) {
1603
1632
  var s1 = _DOMCreateElement("script");
1604
1633
  s1.type = _top.CONFIG.get("sourceType", "text/javascript");
1605
1634
  s1.async = (_top.CONFIG.get("asynchronousImportsLoad")) ? (true) : (false);
1606
- s1.onreadystatechange = function() {
1635
+ s1.onreadystatechange = function () {
1607
1636
  if (s1.readyState === "complete") {
1608
1637
  readyImported.call();
1609
1638
  }
1610
1639
  };
1611
1640
  s1.onload = readyImported;
1612
- s1.onerror = function(e) {
1641
+ s1.onerror = function (e) {
1613
1642
  reject.call(_promise_import_, {
1614
1643
  "_imported_": s1,
1615
1644
  "_package_name_": packagename
@@ -1619,13 +1648,13 @@
1619
1648
  document.getElementsByTagName("head")[0].appendChild(s1);
1620
1649
  }
1621
1650
  });
1622
- _promise_import_.catch(function() {
1651
+ _promise_import_.catch(function () {
1623
1652
  logger.debug("Import: Error loading a package ");
1624
1653
  });
1625
1654
 
1626
1655
  } else {
1627
1656
  // support to be used in a nodejs environment
1628
- _promise_import_ = new Promise(function(resolve, reject) {
1657
+ _promise_import_ = new Promise(function (resolve, reject) {
1629
1658
  try {
1630
1659
  var standardNodePath = findPackageNodePath(packagename);
1631
1660
  var packageAbsoluteName = "";
@@ -1644,29 +1673,32 @@
1644
1673
  "_imported_": require(`${packageAbsoluteName}`),
1645
1674
  "_package_name_": packagename
1646
1675
  });
1647
- }catch (e){
1648
- console.log(e);
1676
+ } catch (e) {
1649
1677
  reject.call(_promise_import_, {
1650
1678
  "_imported_": null,
1651
- "_package_name_": packagename
1679
+ "_package_name_": packagename,
1680
+ "error": e
1652
1681
  });
1653
1682
  }
1654
1683
  } catch (e) {
1655
- console.log(e);
1656
1684
  reject.call(_promise_import_, {
1657
1685
  "_imported_": null,
1658
- "_package_name_": packagename
1686
+ "_package_name_": packagename,
1687
+ "error": e
1659
1688
  });
1660
1689
  }
1661
- }).catch(function(e) {
1690
+ }).catch(function (e) {
1662
1691
  // something wrong importing a package
1663
- console.log(e);
1664
1692
  logger.debug("Something happened when importing " + packagename);
1693
+ console.warn(e);
1665
1694
  });
1666
1695
  }
1696
+ _promise_import_.catch(function (e) {
1697
+ logger.warn(_DataStringify(e));
1698
+ });
1667
1699
  return _promise_import_;
1668
1700
  };
1669
- Import.prototype.toString = function() {
1701
+ Import.prototype.toString = function () {
1670
1702
  return "Import(packagename,ready,external) { [QCObjects native code] }";
1671
1703
  };
1672
1704
 
@@ -1682,31 +1714,31 @@
1682
1714
  }
1683
1715
 
1684
1716
  Class("TagElements", Array, {
1685
- show () {
1686
- this.map(function(element) {
1717
+ show() {
1718
+ this.map(function (element) {
1687
1719
  return element.style.opacity = 1;
1688
1720
  });
1689
1721
  },
1690
- hide () {
1691
- this.map(function(element) {
1722
+ hide() {
1723
+ this.map(function (element) {
1692
1724
  return element.style.opacity = 0;
1693
1725
  });
1694
1726
  },
1695
- effect () {
1727
+ effect() {
1696
1728
  var effectArguments = [...arguments].slice(1);
1697
1729
  var effectClass = arguments[0];
1698
1730
  if ((typeof effectClass).toLowerCase() === "string") {
1699
1731
  effectClass = ClassFactory(effectClass);
1700
1732
  }
1701
- this.map(function(element) {
1733
+ this.map(function (element) {
1702
1734
  return effectClass.apply.apply(effectClass, [element].concat(effectArguments));
1703
1735
  });
1704
1736
  },
1705
- findElements (elementName) {
1737
+ findElements(elementName) {
1706
1738
  var _o = New(ClassFactory("TagElements"));
1707
1739
  if (isBrowser) {
1708
1740
  for (var _k in this) {
1709
- if (typeof _k === "number" && typeof this[_k] !== "function" && this[_k].hasOwnProperty.call(this[_k],"subelements")) {
1741
+ if (typeof _k === "number" && typeof this[_k] !== "function" && this[_k].hasOwnProperty.call(this[_k], "subelements")) {
1710
1742
  _o.push(this[_k].subelements(elementName));
1711
1743
  }
1712
1744
  }
@@ -1723,13 +1755,13 @@
1723
1755
  * @param {Object} tagname
1724
1756
  * @param {Object} innerHTML
1725
1757
  */
1726
- var Tag = function(tagname, innerHTML) {
1758
+ var Tag = function (tagname, innerHTML) {
1727
1759
  var _o = New(ClassFactory("TagElements"));
1728
1760
  if (isBrowser) {
1729
1761
  var o = document.subelements(tagname);
1730
1762
  var addedKeys = [];
1731
1763
  for (var _i = 0; _i < o.length; _i++) {
1732
- if (typeof innerHTML !== "undefined" && o[_i].hasOwnProperty.call(o[_i],"innerHTML")) {
1764
+ if (typeof innerHTML !== "undefined" && o[_i].hasOwnProperty.call(o[_i], "innerHTML")) {
1733
1765
  o[_i].innerHTML = innerHTML;
1734
1766
  }
1735
1767
  if (addedKeys.indexOf(_i) < 0) {
@@ -1760,9 +1792,9 @@
1760
1792
  *
1761
1793
  * @param {Object} e
1762
1794
  */
1763
- var _Ready = function(e) {
1764
- var _execReady = function() {
1765
- _QC_READY_LISTENERS.map(function (_ready_listener_,_r){
1795
+ var _Ready = function (e) {
1796
+ var _execReady = function () {
1797
+ _QC_READY_LISTENERS.map(function (_ready_listener_, _r) {
1766
1798
  if (typeof _ready_listener_ === "function") {
1767
1799
  _ready_listener_.call();
1768
1800
  delete _QC_READY_LISTENERS[_r];
@@ -1808,7 +1840,7 @@
1808
1840
  * });
1809
1841
  *
1810
1842
  */
1811
- class DDO extends ClassFactory ("InheritClass") {
1843
+ class DDO extends ClassFactory("InheritClass") {
1812
1844
  constructor({
1813
1845
  instance,
1814
1846
  name,
@@ -1833,7 +1865,7 @@
1833
1865
 
1834
1866
  }
1835
1867
 
1836
- _new_ ({
1868
+ _new_({
1837
1869
  instance,
1838
1870
  name,
1839
1871
  fget,
@@ -1853,14 +1885,14 @@
1853
1885
  } else {
1854
1886
  ret = _value;
1855
1887
  }
1856
- instance["_"+name] = ret;
1888
+ instance["_" + name] = ret;
1857
1889
  return;
1858
1890
  },
1859
1891
  get() {
1860
- let _value = instance["_"+name];
1892
+ let _value = instance["_" + name];
1861
1893
  logger.debug("returning value " + name);
1862
- var is_ddo = function(v) {
1863
- if (typeof v === "object" && Object.hasOwnProperty.call(v,"value")) {
1894
+ var is_ddo = function (v) {
1895
+ if (typeof v === "object" && Object.hasOwnProperty.call(v, "value")) {
1864
1896
  return v.value;
1865
1897
  }
1866
1898
  return v;
@@ -1877,11 +1909,11 @@
1877
1909
  }
1878
1910
 
1879
1911
  }
1880
- Export (DDO);
1912
+ Export(DDO);
1881
1913
 
1882
1914
  Class("DefaultTemplateHandler", Object, {
1883
1915
  template: "",
1884
- assign (data) {
1916
+ assign(data) {
1885
1917
  var templateInstance = this;
1886
1918
  if (typeof templateInstance.component === "undefined") {
1887
1919
  throw new Error("DefaultTemplateHandler.assign: component is undefined");
@@ -1890,39 +1922,41 @@
1890
1922
  throw new Error("DefaultTemplateHandler.assign: component.processorHandler is undefined");
1891
1923
  }
1892
1924
  var processorHandler = templateInstance.component.processorHandler;
1893
- var parsedAssignmentText = (typeof templateInstance.template !== "undefined")?(templateInstance.template):("");
1894
- if (typeof data === "object"){
1895
- [...Object.keys(data)].map(function (k){
1925
+ var parsedAssignmentText = (typeof templateInstance.template !== "undefined") ? (templateInstance.template) : ("");
1926
+ if (typeof data === "object") {
1927
+ [...Object.keys(data)].map(function (k) {
1896
1928
  var _value = data[k];
1897
- if (typeof _value === "string" || typeof _value === "number" || (!isNaN(_value))){
1929
+ if (typeof _value === "string" || typeof _value === "number" || (!isNaN(_value))) {
1898
1930
  try {
1899
- _value = ClassFactory("Processor").processObject.call(processorHandler,_value);
1931
+ _value = ClassFactory("Processor").processObject.call(processorHandler, _value);
1900
1932
  parsedAssignmentText = parsedAssignmentText.replace((new RegExp(`{{${k}}}`, "g")), _value);
1901
- }catch (e){
1933
+ } catch (e) {
1902
1934
  logger.warn(e);
1903
1935
  }
1904
1936
  }
1905
1937
  });
1906
1938
  } else {
1907
- logger.debug (`${templateInstance.component.name}.data is not an object`);
1939
+ logger.debug(`${templateInstance.component.name}.data is not an object`);
1908
1940
  }
1909
- parsedAssignmentText = ClassFactory("Processor").processObject.call(processorHandler,parsedAssignmentText);
1941
+ parsedAssignmentText = ClassFactory("Processor").processObject.call(processorHandler, parsedAssignmentText);
1910
1942
  return parsedAssignmentText;
1911
1943
  }
1912
1944
  });
1913
1945
 
1914
- var __routing_params__ = function (routing, routingPath){
1915
- let standardRoutingPath = routing.path.replace(/{(.*?)}/g,"(?<$1>.*)"); //allowing {param}
1916
- return {...[...routingPath.matchAll((new RegExp( standardRoutingPath ,"g")))][0]["groups"]};
1946
+ var __routing_params__ = function (routing, routingPath) {
1947
+ let standardRoutingPath = routing.path.replace(/{(.*?)}/g, "(?<$1>.*)"); //allowing {param}
1948
+ return {
1949
+ ...[...routingPath.matchAll((new RegExp(standardRoutingPath, "g")))][0]["groups"]
1950
+ };
1917
1951
  };
1918
1952
 
1919
- var __valid_routings__ = function (routings, routingPath){
1920
- return routings.filter(function(routing) {
1921
- var standardRoutingPath = routing.path.replace(/{(.*?)}/g,"(?<$1>.*)");
1953
+ var __valid_routings__ = function (routings, routingPath) {
1954
+ return routings.filter(function (routing) {
1955
+ var standardRoutingPath = routing.path.replace(/{(.*?)}/g, "(?<$1>.*)");
1922
1956
  return (new RegExp(standardRoutingPath, "g")).test(routingPath);
1923
1957
  }).reverse();
1924
1958
  };
1925
- var __valid_routing_way__ = function (validRoutingWays, routingWay){
1959
+ var __valid_routing_way__ = function (validRoutingWays, routingWay) {
1926
1960
  return validRoutingWays.includes(routingWay);
1927
1961
  };
1928
1962
 
@@ -1931,12 +1965,12 @@
1931
1965
  {
1932
1966
  if (isBrowser) {
1933
1967
  if (!_top._bindroute_.__assigned) {
1934
- document.addEventListener("componentsloaded", function(e) {
1968
+ document.addEventListener("componentsloaded", function (e) {
1935
1969
  e.stopImmediatePropagation();
1936
1970
  e.stopPropagation();
1937
1971
  if (!_top._bindroute_.__assigned) {
1938
1972
 
1939
- _top.onpopstate = function(e) {
1973
+ _top.onpopstate = function (e) {
1940
1974
  e.stopImmediatePropagation();
1941
1975
  e.stopPropagation();
1942
1976
  ClassFactory("Component").route();
@@ -1944,9 +1978,9 @@
1944
1978
  e.target.__oldpopstate.call(e.target, e);
1945
1979
  }
1946
1980
  };
1947
- Tag("a").map(function(a) {
1981
+ Tag("a").map(function (a) {
1948
1982
  a.oldclick = a.onclick;
1949
- a.onclick = function(e) {
1983
+ a.onclick = function (e) {
1950
1984
  var _ret_ = true;
1951
1985
  if (!_top.global.get("routingPaths")) {
1952
1986
  _top.global.set("routingPaths", []);
@@ -1985,7 +2019,7 @@
1985
2019
  }
1986
2020
  }
1987
2021
  };
1988
- Class ("Component", ClassFactory("InheritClass"), {
2022
+ Class("Component", ClassFactory("InheritClass"), {
1989
2023
  domain: domain,
1990
2024
  basePath: basePath,
1991
2025
  templateURI: "",
@@ -1998,38 +2032,38 @@
1998
2032
  method: "GET",
1999
2033
  data: {},
2000
2034
  reload: false,
2001
- shadowed:false,
2035
+ shadowed: false,
2002
2036
  cached: true,
2003
- done () {
2037
+ done() {
2004
2038
  //TODO: default done method
2005
2039
  },
2006
- fail () {
2040
+ fail() {
2007
2041
  //TODO: default fail method
2008
2042
  },
2009
- set (name, value) {
2043
+ set(name, value) {
2010
2044
  this[name] = value;
2011
2045
  },
2012
- get (name) {
2046
+ get(name) {
2013
2047
  return this[name];
2014
- },
2048
+ },
2015
2049
  __promise__: null,
2016
- feedComponent (){
2050
+ feedComponent() {
2017
2051
  var _component_ = this;
2018
- var _feedComponent_InBrowser = function (_component_){
2052
+ var _feedComponent_InBrowser = function (_component_) {
2019
2053
  if (typeof _component_.container === "undefined" && typeof _component_.body === "undefined") {
2020
- logger.warn ("COMPONENT {{NAME}} has an undefined container and body".replace("{{NAME}}", _component_.name));
2054
+ logger.warn("COMPONENT {{NAME}} has an undefined container and body".replace("{{NAME}}", _component_.name));
2021
2055
  return;
2022
2056
  }
2023
2057
  var container = (typeof _component_.container === "undefined" || _component_.container === null) ? (_component_.body) : (_component_.container);
2024
2058
  var parsedAssignmentText = _component_.parsedAssignmentText;
2025
2059
  _component_.innerHTML = parsedAssignmentText;
2026
- if (_component_.shadowed){
2060
+ if (_component_.shadowed) {
2027
2061
  logger.debug("COMPONENT {{NAME}} is shadowed".replace("{{NAME}}", _component_.name));
2028
2062
  logger.debug("Preparing slots for Shadowed COMPONENT {{NAME}}".replace("{{NAME}}", _component_.name));
2029
2063
  var tmp_shadowContainer = _DOMCreateElement("div");
2030
2064
  container.subelements("[slot]").map(
2031
- function (c){
2032
- if (c.parentElement===container){
2065
+ function (c) {
2066
+ if (c.parentElement === container) {
2033
2067
  tmp_shadowContainer.appendChild(c);
2034
2068
  }
2035
2069
  });
@@ -2037,16 +2071,18 @@
2037
2071
  var shadowContainer = _DOMCreateElement("div");
2038
2072
  shadowContainer.classList.add("shadowHost");
2039
2073
  try {
2040
- _component_.shadowRoot = shadowContainer.attachShadow({mode: "open"});
2041
- } catch (e){
2074
+ _component_.shadowRoot = shadowContainer.attachShadow({
2075
+ mode: "open"
2076
+ });
2077
+ } catch (e) {
2042
2078
  try {
2043
2079
  logger.debug("Shadowed COMPONENT {{NAME}} is repeated".replace("{{NAME}}", _component_.name));
2044
2080
  _component_.shadowRoot = shadowContainer.shadowRoot;
2045
- } catch (e){
2081
+ } catch (e) {
2046
2082
  logger.warn("Shadowed COMPONENT {{NAME}} is not allowed on this browser".replace("{{NAME}}", _component_.name));
2047
2083
  }
2048
2084
  }
2049
- if (typeof _component_.shadowRoot !== "undefined" && _component_.shadowRoot !== null){
2085
+ if (typeof _component_.shadowRoot !== "undefined" && _component_.shadowRoot !== null) {
2050
2086
  if (_component_.reload) {
2051
2087
  logger.debug("FORCED RELOADING OF CONTAINER FOR Shadowed COMPONENT {{NAME}}".replace("{{NAME}}", _component_.name));
2052
2088
  shadowContainer.shadowRoot.innerHTML = _component_.innerHTML;
@@ -2058,7 +2094,7 @@
2058
2094
  logger.debug("ADDING Slots to Shadowed COMPONENT {{NAME}} ".replace("{{NAME}}", _component_.name));
2059
2095
  shadowContainer.innerHTML += tmp_shadowContainer.innerHTML;
2060
2096
  logger.debug("APPENDING Shadowed COMPONENT {{NAME}} to Container ".replace("{{NAME}}", _component_.name));
2061
- if (container.subelements(".shadowHost")<1){
2097
+ if (container.subelements(".shadowHost") < 1) {
2062
2098
  container.appendChild(shadowContainer);
2063
2099
  } else {
2064
2100
  logger.debug("Shadowed Container for COMPONENT {{NAME}} is already present in the tree ".replace("{{NAME}}", _component_.name));
@@ -2072,7 +2108,7 @@
2072
2108
  if (_component_.reload) {
2073
2109
  logger.debug("FORCED RELOADING OF CONTAINER FOR COMPONENT {{NAME}}".replace("{{NAME}}", _component_.name));
2074
2110
  container.innerHTML = _component_.innerHTML;
2075
- } else if (container && _component_){
2111
+ } else if (container && _component_) {
2076
2112
  logger.debug("ADDING COMPONENT {{NAME}} ".replace("{{NAME}}", _component_.name));
2077
2113
  container.innerHTML += _component_.innerHTML;
2078
2114
  } else {
@@ -2082,30 +2118,30 @@
2082
2118
 
2083
2119
  };
2084
2120
 
2085
- var _feedComponent_InNode = function (_component_){
2121
+ var _feedComponent_InNode = function (_component_) {
2086
2122
  var parsedAssignmentText = _component_.parsedAssignmentText;
2087
2123
  _component_.innerHTML = parsedAssignmentText;
2088
2124
  };
2089
2125
 
2090
2126
  var _ret_;
2091
- if (!is_a(_component_, "Component")){
2127
+ if (!is_a(_component_, "Component")) {
2092
2128
  logger.warn("Trying to feed a non component object");
2093
2129
  return;
2094
2130
  }
2095
- if (isBrowser){
2131
+ if (isBrowser) {
2096
2132
  _ret_ = _feedComponent_InBrowser(_component_);
2097
2133
  } else {
2098
2134
  _ret_ = _feedComponent_InNode(_component_);
2099
2135
  }
2100
2136
  return _ret_;
2101
2137
  },
2102
- rebuild () {
2138
+ rebuild() {
2103
2139
  var _component = this;
2104
- var _promise = new Promise(function(resolve, reject) {
2105
- if (typeof _component === "undefined" || _component === null){
2140
+ var _promise = new Promise(function (resolve, reject) {
2141
+ if (typeof _component === "undefined" || _component === null) {
2106
2142
  reject("Component is undefined");
2107
2143
  }
2108
- if (isQCObjects_Object(_component) && is_a(_component, "Component")){
2144
+ if (isQCObjects_Object(_component) && is_a(_component, "Component")) {
2109
2145
  switch (true) {
2110
2146
  case (_component.get("tplsource") === "none"):
2111
2147
  logger.debug("Component " + _component.name + " has specified template-source=none, so no template load was done");
@@ -2134,10 +2170,10 @@
2134
2170
  _component.get("templateURI") !== ""):
2135
2171
  _component.set("url", _component.get("basePath") + _component.get("templateURI"));
2136
2172
  componentLoader(_component, false).then(
2137
- function(standardResponse) {
2173
+ function (standardResponse) {
2138
2174
  resolve.call(_promise, standardResponse);
2139
2175
  },
2140
- function(standardResponse) {
2176
+ function (standardResponse) {
2141
2177
  reject.call(_promise, standardResponse);
2142
2178
  });
2143
2179
  break;
@@ -2145,10 +2181,10 @@
2145
2181
  _component.get("templateURI") !== ""):
2146
2182
  _component.set("url", _component.get("templateURI"));
2147
2183
  componentLoader(_component, false).then(
2148
- function(standardResponse) {
2184
+ function (standardResponse) {
2149
2185
  resolve.call(_promise, standardResponse);
2150
2186
  },
2151
- function(standardResponse) {
2187
+ function (standardResponse) {
2152
2188
  reject.call(_promise, standardResponse);
2153
2189
  });
2154
2190
  break;
@@ -2164,14 +2200,18 @@
2164
2200
  });
2165
2201
  break;
2166
2202
  }
2167
-
2203
+
2168
2204
  }
2169
2205
  });
2170
2206
  return _promise;
2171
2207
  },
2172
- Cast (oClass) {
2208
+ Cast(oClass) {
2173
2209
  /* Cast method for components has been deprecated. Don't use this method, it is available only for compatibility purposes */
2174
- let o = _methods_(oClass).map(m=>m.name.replace(/bound /g, "")).map(m=>{return {[m]:oClass[m].bind(this)};}).reduce((c,p)=>Object.assign(c, p), {});
2210
+ let o = _methods_(oClass).map(m => m.name.replace(/bound /g, "")).map(m => {
2211
+ return {
2212
+ [m]: oClass[m].bind(this)
2213
+ };
2214
+ }).reduce((c, p) => Object.assign(c, p), {});
2175
2215
  return _Cast(this, o);
2176
2216
  },
2177
2217
  routingWay: null,
@@ -2179,29 +2219,32 @@
2179
2219
  routingNodes: [],
2180
2220
  routings: [],
2181
2221
  routingPath: "",
2182
- route () {
2222
+ route() {
2183
2223
  var componentClass = this;
2184
2224
  var isValidInstance = ((!!componentClass.__instanceID) &&
2185
- Object.hasOwnProperty.call(componentClass,"subcomponents")) ? (true) : (false);
2186
- var __route__ = function(componentList) {
2225
+ Object.hasOwnProperty.call(componentClass, "subcomponents")) ? (true) : (false);
2226
+ var __route__ = function (componentList) {
2187
2227
  var _componentNames_ = [];
2188
- var _promises_ = componentList.filter(function (rc){return typeof rc !== "undefined";}).map(function (rc){
2189
- if (typeof rc.name !== "undefined"){
2228
+ var _promises_ = componentList.filter(function (rc) {
2229
+ return typeof rc !== "undefined";
2230
+ }).map(function (rc) {
2231
+ if (typeof rc.name !== "undefined") {
2190
2232
  _componentNames_.push(rc.name);
2191
2233
  } else {
2192
- throw new Error(__getType__(rc)+" does not have a name");
2234
+ throw new Error(__getType__(rc) + " does not have a name");
2193
2235
  }
2194
- return new Promise (function (resolve, reject){
2236
+ return new Promise(function (resolve, reject) {
2195
2237
  var _promise_;
2196
- if (typeof rc !== "undefined"
2197
- && Object.hasOwnProperty.call(rc,"_reroute_")){
2238
+ if (typeof rc !== "undefined" &&
2239
+ Object.hasOwnProperty.call(rc, "_reroute_")) {
2198
2240
  _promise_ = rc._reroute_()
2199
- .then(function (){
2200
- rc.body.innerHTML = "";
2201
- rc.innerHTML = "";
2202
- return rc.rebuild();})
2203
- .then (function (_rc_){
2204
- if (Object.hasOwnProperty.call(_rc_,"subcomponents") &&
2241
+ .then(function () {
2242
+ rc.body.innerHTML = "";
2243
+ rc.innerHTML = "";
2244
+ return rc.rebuild();
2245
+ })
2246
+ .then(function (_rc_) {
2247
+ if (Object.hasOwnProperty.call(_rc_, "subcomponents") &&
2205
2248
  typeof _rc_.subcomponents !== "undefined" &&
2206
2249
  _rc_.subcomponents.length > 0
2207
2250
  ) {
@@ -2211,21 +2254,21 @@
2211
2254
  resolve(_rc_);
2212
2255
  }
2213
2256
  });
2214
- } else if (typeof rc !== "undefined"){
2257
+ } else if (typeof rc !== "undefined") {
2215
2258
  reject("Component " + rc.name + " is not an instance of Component");
2216
2259
  }
2217
2260
  return _promise_;
2218
2261
  });
2219
2262
  });
2220
2263
  return Promise.all(_promises_)
2221
- .then(function (){
2222
- logger.debug("ROUTING COMPLETED FOR "+ _componentNames_.join(", "));
2223
- }).catch(function (err){
2224
- logger.error("ROUTING FAILED FOR "+ _componentNames_.join(", ") + ": " + err);
2264
+ .then(function () {
2265
+ logger.debug("ROUTING COMPLETED FOR " + _componentNames_.join(", "));
2266
+ }).catch(function (err) {
2267
+ logger.error("ROUTING FAILED FOR " + _componentNames_.join(", ") + ": " + err);
2225
2268
  });
2226
2269
  };
2227
- if (isValidInstance || Object.hasOwnProperty.call(global,"componentsStack")) {
2228
- if (isValidInstance && is_a(componentClass, "Component")){
2270
+ if (isValidInstance || Object.hasOwnProperty.call(global, "componentsStack")) {
2271
+ if (isValidInstance && is_a(componentClass, "Component")) {
2229
2272
  logger.debug("loading routings for instance " + componentClass.name);
2230
2273
  }
2231
2274
  __route__.call(componentClass, (isValidInstance) ? (componentClass.subcomponents) : (global.componentsStack));
@@ -2233,7 +2276,7 @@
2233
2276
  logger.debug("An undetermined result expected if load routings. So will not be loaded this time.");
2234
2277
  }
2235
2278
  },
2236
- fullscreen () {
2279
+ fullscreen() {
2237
2280
  if (isBrowser) {
2238
2281
  var elem = this.body;
2239
2282
  if (elem.requestFullscreen) {
@@ -2252,7 +2295,7 @@
2252
2295
  // not yet implemented.
2253
2296
  }
2254
2297
  },
2255
- closefullscreen () {
2298
+ closefullscreen() {
2256
2299
  if (isBrowser) {
2257
2300
  if (document.exitFullscreen) {
2258
2301
  document.exitFullscreen();
@@ -2267,7 +2310,7 @@
2267
2310
  // noy yet implemented.
2268
2311
  }
2269
2312
  },
2270
- _generateRoutingPaths (componentBody) {
2313
+ _generateRoutingPaths(componentBody) {
2271
2314
  var component = this;
2272
2315
  if (isBrowser) {
2273
2316
  if (__valid_routing_way__(component.validRoutingWays, component.routingWay)) {
@@ -2275,10 +2318,10 @@
2275
2318
  component.innerHTML = componentBody.innerHTML;
2276
2319
  component.routingNodes = componentBody.subelements("routing");
2277
2320
  component.routings = [];
2278
- component.routingNodes.map(function (routingNode, r){
2321
+ component.routingNodes.map(function (routingNode, r) {
2279
2322
  var attributeNames = routingNode.getAttributeNames();
2280
2323
  var routing = {};
2281
- attributeNames.map(function (attributeName, a){
2324
+ attributeNames.map(function (attributeName, a) {
2282
2325
  routing[attributeNames[a]] = routingNode.getAttribute(attributeNames[a]);
2283
2326
  });
2284
2327
  component.routings.push(routing);
@@ -2295,10 +2338,10 @@
2295
2338
  // not yet implemented.
2296
2339
  }
2297
2340
  },
2298
- parseTemplate (template){
2341
+ parseTemplate(template) {
2299
2342
  var _self = this;
2300
2343
  var _parsedAssignmentText;
2301
- if (Object.hasOwnProperty.call(_self,"templateHandler")) {
2344
+ if (Object.hasOwnProperty.call(_self, "templateHandler")) {
2302
2345
  var value = template;
2303
2346
  var templateHandlerName = _self.templateHandler;
2304
2347
  var templateHandlerClass = ClassFactory(_self.templateHandler);
@@ -2307,10 +2350,10 @@
2307
2350
  template: value
2308
2351
  });
2309
2352
  var selfData = _self.data;
2310
- if (Object.hasOwnProperty.call(_self,"assignRoutingParams") && _self.assignRoutingParams){
2353
+ if (Object.hasOwnProperty.call(_self, "assignRoutingParams") && _self.assignRoutingParams) {
2311
2354
  try {
2312
- selfData = Object.assign(selfData,_self.routingParams);
2313
- }catch (e){
2355
+ selfData = Object.assign(selfData, _self.routingParams);
2356
+ } catch (e) {
2314
2357
  logger.debug("[parseTemplate] it was not possible to assign the routing params to the template");
2315
2358
  }
2316
2359
  }
@@ -2320,16 +2363,16 @@
2320
2363
  }
2321
2364
  return _parsedAssignmentText;
2322
2365
  },
2323
- _new_ (properties) {
2366
+ _new_(properties) {
2324
2367
  var self = this;
2325
2368
 
2326
- if (typeof self.name === "undefined"){
2327
- logger.warn("A name is not defined for "+__getType__(self));
2369
+ if (typeof self.name === "undefined") {
2370
+ logger.warn("A name is not defined for " + __getType__(self));
2328
2371
  }
2329
2372
 
2330
2373
  self.routingWay = _top.CONFIG.get("routingWay");
2331
2374
 
2332
- self.processorHandler = New(ClassFactory("Processor"),{
2375
+ self.processorHandler = New(ClassFactory("Processor"), {
2333
2376
  component: self
2334
2377
  });
2335
2378
 
@@ -2352,7 +2395,7 @@
2352
2395
  },
2353
2396
  get() {
2354
2397
  var __routing_path__ = _DataStringify(self.routingPath);
2355
- return Base64.encode(self.name + __routing_path__ );
2398
+ return Base64.encode(self.name + __routing_path__);
2356
2399
  }
2357
2400
  });
2358
2401
 
@@ -2371,7 +2414,7 @@
2371
2414
  Object.defineProperty(self, "shadowRoot", {
2372
2415
  configurable: true,
2373
2416
  set(value) {
2374
- if (typeof self.__shadowRoot == "undefined"){
2417
+ if (typeof self.__shadowRoot == "undefined") {
2375
2418
  self.__shadowRoot = value;
2376
2419
  } else {
2377
2420
  logger.debug("[shadowRoot] This property can only be assigned once!");
@@ -2382,57 +2425,59 @@
2382
2425
  }
2383
2426
  });
2384
2427
 
2385
- Object.defineProperty(self, "routingSelected",{
2428
+ Object.defineProperty(self, "routingSelected", {
2386
2429
  configurable: true,
2387
- set(value){
2430
+ set(value) {
2388
2431
  logger.debug("[routingSelected] This is a read-only property of the component");
2389
2432
  },
2390
- get(){
2391
- return __valid_routings__(this.routings,this.routingPath);
2433
+ get() {
2434
+ return __valid_routings__(this.routings, this.routingPath);
2392
2435
  }
2393
2436
  });
2394
2437
 
2395
- Object.defineProperty(self, "routingParams",{
2438
+ Object.defineProperty(self, "routingParams", {
2396
2439
  configurable: true,
2397
- set(value){
2440
+ set(value) {
2398
2441
  logger.debug("[routingParams] This is a read-only property of the component");
2399
2442
  },
2400
- get(){
2443
+ get() {
2401
2444
  var component = this;
2402
- return [{}].concat(component.routingSelected.map(function (routing){
2403
- return __routing_params__(routing,component.routingPath);
2404
- })).reduce(function (accumulator, colData, index){return Object.assign(accumulator, colData);});
2445
+ return [{}].concat(component.routingSelected.map(function (routing) {
2446
+ return __routing_params__(routing, component.routingPath);
2447
+ })).reduce(function (accumulator, colData, index) {
2448
+ return Object.assign(accumulator, colData);
2449
+ });
2405
2450
  }
2406
2451
  });
2407
2452
 
2408
- if (typeof self.__new__ === "function"){
2409
- self.__new__.call(self,properties);
2453
+ if (typeof self.__new__ === "function") {
2454
+ self.__new__.call(self, properties);
2410
2455
  }
2411
2456
 
2412
2457
  self._reroute_()
2413
- .then(function (){
2458
+ .then(function () {
2414
2459
  return self.rebuild()
2415
- .then (function (){
2416
- logger.info(`Component._new_ The component ${self.name} was built successfully!`);
2417
- }).catch (function (standardResponse){
2418
- logger.warn(`Component._new_ Something went wrong building the component ${self.name}`);
2419
- console.error(standardResponse);
2420
- });
2421
- });
2422
-
2460
+ .then(function () {
2461
+ logger.info(`Component._new_ The component ${self.name} was built successfully!`);
2462
+ }).catch(function (standardResponse) {
2463
+ logger.warn(`Component._new_ Something went wrong building the component ${self.name}`);
2464
+ console.error(standardResponse);
2465
+ });
2466
+ });
2467
+
2423
2468
  },
2424
- _reroute_ () {
2469
+ _reroute_() {
2425
2470
  /* This method set the selected routing and makes the switch to the templateURI */
2426
2471
  var rc = this;
2427
- return new Promise (function (resolve, reject) {
2428
- if (isBrowser){
2472
+ return new Promise(function (resolve, reject) {
2473
+ if (isBrowser) {
2429
2474
  if (__valid_routing_way__(rc.validRoutingWays, rc.routingWay)) {
2430
2475
  rc.routingPath = document.location[rc.routingWay];
2431
- rc.routingSelected.map(function (routing, r){
2476
+ rc.routingSelected.map(function (routing, r) {
2432
2477
  var componentURI = ComponentURI({
2433
2478
  "COMPONENTS_BASE_PATH": _top.CONFIG.get("componentsBasePath"),
2434
2479
  "COMPONENT_NAME": routing.name.toString(),
2435
- "TPLEXTENSION": (Object.hasOwnProperty.call(routing,"tplextension")) ? (routing.tplextension) : (rc.tplextension),
2480
+ "TPLEXTENSION": (Object.hasOwnProperty.call(routing, "tplextension")) ? (routing.tplextension) : (rc.tplextension),
2436
2481
  "TPL_SOURCE": "default" /* here is always default in order to get the right uri */
2437
2482
  });
2438
2483
  rc.templateURI = componentURI;
@@ -2444,15 +2489,15 @@
2444
2489
  }
2445
2490
  }
2446
2491
  resolve(rc);
2447
-
2492
+
2448
2493
  });
2449
2494
  },
2450
- lazyLoadImages (){
2451
- if (isBrowser){
2495
+ lazyLoadImages() {
2496
+ if (isBrowser) {
2452
2497
  var component = this;
2453
- var _componentRoot = (component.shadowed)?(component.shadowRoot):(component.body);
2498
+ var _componentRoot = (component.shadowed) ? (component.shadowRoot) : (component.body);
2454
2499
  var _imgLazyLoaded = [..._componentRoot.subelements("img[lazy-src]")];
2455
- var _lazyLoadImages = function(image) {
2500
+ var _lazyLoadImages = function (image) {
2456
2501
  image.setAttribute("src", image.getAttribute("lazy-src"));
2457
2502
  image.onload = () => {
2458
2503
  image.removeAttribute("lazy-src");
@@ -2467,7 +2512,7 @@
2467
2512
  }
2468
2513
  });
2469
2514
  });
2470
- _imgLazyLoaded.map(function(img) {
2515
+ _imgLazyLoaded.map(function (img) {
2471
2516
  return observer.observe(img);
2472
2517
  });
2473
2518
  } else {
@@ -2479,7 +2524,7 @@
2479
2524
  }
2480
2525
  return null;
2481
2526
  },
2482
- applyTransitionEffect (effectClassName) {
2527
+ applyTransitionEffect(effectClassName) {
2483
2528
  var _Effect = ClassFactory(effectClassName);
2484
2529
  if (typeof _Effect !== "undefined" && is_a(_Effect, "TransitionEffect")) {
2485
2530
  this.effect = New(_Effect, {
@@ -2490,11 +2535,11 @@
2490
2535
  logger.debug(`${__getType__(_Effect)} is not a TransitionEffect`);
2491
2536
  }
2492
2537
  },
2493
- applyObserveTransitionEffect (effectClassName) {
2494
- if (isBrowser){
2538
+ applyObserveTransitionEffect(effectClassName) {
2539
+ if (isBrowser) {
2495
2540
  var component = this;
2496
- var _componentRoot = (component.shadowed)?(component.shadowRoot):(component.body);
2497
- var _applyEffect_ = function(element) {
2541
+ var _componentRoot = (component.shadowed) ? (component.shadowRoot) : (component.body);
2542
+ var _applyEffect_ = function (element) {
2498
2543
  component.applyTransitionEffect(effectClassName);
2499
2544
  };
2500
2545
  if ("IntersectionObserver" in window) {
@@ -2515,16 +2560,20 @@
2515
2560
  }
2516
2561
  return null;
2517
2562
  },
2518
- scrollIntoHash (){
2519
- if (isBrowser){
2563
+ scrollIntoHash() {
2564
+ if (isBrowser) {
2520
2565
  var component = this;
2521
- if (document.location.hash !== ""){
2522
- var _componentRoot = (component.shadowed)?(component.shadowRoot):(component.body);
2566
+ if (document.location.hash !== "") {
2567
+ var _componentRoot = (component.shadowed) ? (component.shadowRoot) : (component.body);
2523
2568
  _componentRoot.subelements(document.location.hash).map(
2524
- function (element){
2525
- if (typeof element.scrollIntoView === "function"){
2569
+ function (element) {
2570
+ if (typeof element.scrollIntoView === "function") {
2526
2571
  element.scrollIntoView(
2527
- _top.CONFIG.get("scrollIntoHash",{behavior: "auto", block: "top", inline: "top"})
2572
+ _top.CONFIG.get("scrollIntoHash", {
2573
+ behavior: "auto",
2574
+ block: "top",
2575
+ inline: "top"
2576
+ })
2528
2577
  );
2529
2578
  }
2530
2579
  }
@@ -2534,36 +2583,36 @@
2534
2583
  // not yet implemented
2535
2584
  }
2536
2585
  },
2537
- i18n_translate (){
2538
- if (isBrowser){
2539
- if (_top.CONFIG.get("use_i18n")){
2586
+ i18n_translate() {
2587
+ if (isBrowser) {
2588
+ if (_top.CONFIG.get("use_i18n")) {
2540
2589
  var component = this;
2541
- var _componentRoot = (component.shadowed)?(component.shadowRoot):(component.body);
2542
- var lang1=_top.CONFIG.get("lang","en");
2590
+ var _componentRoot = (component.shadowed) ? (component.shadowRoot) : (component.body);
2591
+ var lang1 = _top.CONFIG.get("lang", "en");
2543
2592
  var lang2 = navigator.language.slice(0, 2);
2544
2593
  var i18n = _top.global.get("i18n");
2545
- if ((lang1 !== lang2) && (typeof i18n === "object" && Object.hasOwnProperty.call(i18n,"messages"))){
2546
- var callback_i18n = function (){
2594
+ if ((lang1 !== lang2) && (typeof i18n === "object" && Object.hasOwnProperty.call(i18n, "messages"))) {
2595
+ var callback_i18n = function () {
2547
2596
  var component = this;
2548
- return new Promise(function (resolve, reject){
2549
- var messages = i18n.messages.filter(function (message){
2550
- return Object.hasOwnProperty.call(message,lang1) && Object.hasOwnProperty.call(message,lang2);
2597
+ return new Promise(function (resolve, reject) {
2598
+ var messages = i18n.messages.filter(function (message) {
2599
+ return Object.hasOwnProperty.call(message, lang1) && Object.hasOwnProperty.call(message, lang2);
2551
2600
  });
2552
2601
  _componentRoot.subelements("ul,li,h1,h2,h3,a,b,p,input,textarea,summary,details,option,component")
2553
- .map(function (element){
2554
- messages.map(function (message){
2555
- var _innerHTML = element.innerHTML;
2556
- _innerHTML = _innerHTML.replace(new RegExp(`${message[lang1]}`,"g"),message[lang2]);
2557
- element.innerHTML = _innerHTML;
2558
- return null;
2602
+ .map(function (element) {
2603
+ messages.map(function (message) {
2604
+ var _innerHTML = element.innerHTML;
2605
+ _innerHTML = _innerHTML.replace(new RegExp(`${message[lang1]}`, "g"), message[lang2]);
2606
+ element.innerHTML = _innerHTML;
2607
+ return null;
2608
+ });
2609
+ return element;
2559
2610
  });
2560
- return element;
2561
- });
2562
2611
  resolve();
2563
2612
  });
2564
2613
  };
2565
- callback_i18n.call(component).then(function (){
2566
- logger.debug("i18n loaded for component: "+component.name);
2614
+ callback_i18n.call(component).then(function () {
2615
+ logger.debug("i18n loaded for component: " + component.name);
2567
2616
  });
2568
2617
 
2569
2618
  }
@@ -2572,48 +2621,48 @@
2572
2621
  // not yet implemented
2573
2622
  }
2574
2623
  },
2575
- _componentHelpers:[],
2576
- addComponentHelper (componentHelper){
2624
+ _componentHelpers: [],
2625
+ addComponentHelper(componentHelper) {
2577
2626
  var component = this;
2578
2627
  component._componentHelpers.push(componentHelper);
2579
2628
  },
2580
- runComponentHelpers () {
2581
- if (isBrowser){
2629
+ runComponentHelpers() {
2630
+ if (isBrowser) {
2582
2631
  var component = this;
2583
2632
  var __component_helpers__ = [];
2584
2633
  /*
2585
- * BEGIN use i18n translation
2586
- */
2634
+ * BEGIN use i18n translation
2635
+ */
2587
2636
  __component_helpers__.push(component.i18n_translate.bind(component));
2588
2637
  /*
2589
- * END use i18n translation
2590
- */
2638
+ * END use i18n translation
2639
+ */
2591
2640
 
2592
2641
  /*
2593
- * BEGIN component scrollIntoHash
2594
- */
2642
+ * BEGIN component scrollIntoHash
2643
+ */
2595
2644
  __component_helpers__.push(component.scrollIntoHash.bind(component));
2596
2645
  /*
2597
- * END component scrollIntoHash
2598
- */
2646
+ * END component scrollIntoHash
2647
+ */
2599
2648
 
2600
2649
  /*
2601
2650
  * BEGIN component images lazy-load
2602
2651
  */
2603
2652
 
2604
- __component_helpers__.push(component.lazyLoadImages.bind(component));
2653
+ __component_helpers__.push(component.lazyLoadImages.bind(component));
2605
2654
 
2606
2655
  /*
2607
2656
  * END component images lazy-load
2608
2657
  */
2609
2658
 
2610
- __component_helpers__ = __component_helpers__.concat(component._componentHelpers);
2659
+ __component_helpers__ = __component_helpers__.concat(component._componentHelpers);
2611
2660
 
2612
- __component_helpers__.map(
2613
- function (_component_helper_){
2614
- _component_helper_();
2615
- }
2616
- );
2661
+ __component_helpers__.map(
2662
+ function (_component_helper_) {
2663
+ _component_helper_();
2664
+ }
2665
+ );
2617
2666
 
2618
2667
  } else {
2619
2668
  // not yet implemented
@@ -2622,43 +2671,53 @@
2622
2671
  }
2623
2672
  });
2624
2673
 
2625
- _top._bindroute_.__assigned=false;
2674
+ _top._bindroute_.__assigned = false;
2626
2675
 
2627
- (_methods_)(ClassFactory("Component")).map(function (__c__){(_protected_code_)(__c__);});
2676
+ (_methods_)(ClassFactory("Component")).map(function (__c__) {
2677
+ (_protected_code_)(__c__);
2678
+ });
2628
2679
 
2629
- Class ("Controller", Object, {
2680
+ Class("Controller", ClassFactory("InheritClass"), {
2630
2681
  dependencies: [],
2631
2682
  component: null,
2632
- routingSelectedAttr (attrName){
2633
- return this.component.routingSelected.map(function (r){return r[attrName];}).filter(function (v){return v;}).pop();
2683
+ routingSelectedAttr(attrName) {
2684
+ return this.component.routingSelected.map(function (r) {
2685
+ return r[attrName];
2686
+ }).filter(function (v) {
2687
+ return v;
2688
+ }).pop();
2634
2689
  },
2635
- isTouchable (){
2636
- return ("ontouchstart" in window)
2637
- || (navigator.MaxTouchPoints > 0)
2638
- || (navigator.msMaxTouchPoints > 0);
2690
+ isTouchable() {
2691
+ return ("ontouchstart" in window) ||
2692
+ (navigator.MaxTouchPoints > 0) ||
2693
+ (navigator.msMaxTouchPoints > 0);
2639
2694
  },
2640
- onpress (subelementSelector,handler){
2695
+ onpress(subelementSelector, handler) {
2641
2696
  try {
2642
- if (this.isTouchable()){
2643
- this.component.body.subelements(subelementSelector)[0].addEventListener("touchstart",handler, {passive:true});
2697
+ if (this.isTouchable()) {
2698
+ this.component.body.subelements(subelementSelector)[0].addEventListener("touchstart", handler, {
2699
+ passive: true
2700
+ });
2644
2701
  } else {
2645
- this.component.body.subelements(subelementSelector)[0].addEventListener("click",handler, {passive:true});
2702
+ this.component.body.subelements(subelementSelector)[0].addEventListener("click", handler, {
2703
+ passive: true
2704
+ });
2646
2705
  }
2647
- }catch (e){
2706
+ } catch (e) {
2648
2707
  logger.debug("No button to assign press event");
2649
2708
  }
2650
2709
  },
2651
- createRoutingController (){
2710
+ createRoutingController() {
2652
2711
  var controller = this;
2653
2712
  var component = controller.component;
2654
2713
  var controllerName = controller.routingSelectedAttr("controllerclass");
2655
- if (typeof controllerName !== "undefined"){
2714
+ if (typeof controllerName !== "undefined") {
2656
2715
  var _Controller = ClassFactory(controllerName);
2657
2716
  if (typeof _Controller !== "undefined") {
2658
2717
  component.routingController = New(_Controller, {
2659
2718
  component: component
2660
2719
  }); // Initializes the main controller for the component
2661
- if (Object.hasOwnProperty.call(component.routingController,"done") && typeof component.routingController.done === "function") {
2720
+ if (Object.hasOwnProperty.call(component.routingController, "done") && typeof component.routingController.done === "function") {
2662
2721
  component.routingController.done.call(component.routingController);
2663
2722
  }
2664
2723
  }
@@ -2666,13 +2725,14 @@
2666
2725
  }
2667
2726
  });
2668
2727
 
2669
- Class("View", Object, {
2728
+ Class("View", ClassFactory("InheritClass"), {
2670
2729
  dependencies: [],
2671
2730
  component: null
2672
2731
  });
2673
2732
 
2674
- Class("Service", Object, {
2675
- kind: "rest", /* it can be rest, mockup, local */
2733
+ Class("Service", ClassFactory("InheritClass"), {
2734
+ kind: "rest",
2735
+ /* it can be rest, mockup, local */
2676
2736
  domain: domain,
2677
2737
  basePath: basePath,
2678
2738
  url: "",
@@ -2680,10 +2740,10 @@
2680
2740
  data: {},
2681
2741
  reload: false,
2682
2742
  cached: false,
2683
- set (name, value) {
2743
+ set(name, value) {
2684
2744
  this[name] = value;
2685
2745
  },
2686
- get (name) {
2746
+ get(name) {
2687
2747
  return this[name];
2688
2748
  }
2689
2749
  });
@@ -2696,7 +2756,7 @@
2696
2756
  "charset": "utf-8"
2697
2757
  },
2698
2758
  JSONresponse: null,
2699
- done (result) {
2759
+ done(result) {
2700
2760
  logger.debug("***** RECEIVED RESPONSE:");
2701
2761
  logger.debug(result.service.template);
2702
2762
  this.JSONresponse = JSON.parse(result.service.template);
@@ -2712,11 +2772,11 @@
2712
2772
  "charset": "utf-8"
2713
2773
  },
2714
2774
  JSONresponse: null,
2715
- done (result) {
2775
+ done(result) {
2716
2776
  logger.debug("***** CONFIG LOADED:");
2717
2777
  logger.debug(result.service.template);
2718
2778
  this.JSONresponse = JSON.parse(result.service.template);
2719
- if (Object.hasOwnProperty.call(this.JSONresponse,"__encoded__")) {
2779
+ if (Object.hasOwnProperty.call(this.JSONresponse, "__encoded__")) {
2720
2780
  this.JSONresponse = JSON.parse(ClassFactory("_Crypt").decrypt(this.JSONresponse.__encoded__, _secretKey));
2721
2781
  }
2722
2782
  for (var k in this.JSONresponse) {
@@ -2724,15 +2784,15 @@
2724
2784
  }
2725
2785
  this.configLoaded.call(this);
2726
2786
  },
2727
- fail (result) {
2787
+ fail(result) {
2728
2788
  this.configLoaded.call(this);
2729
2789
  },
2730
- _new_ (o) {
2790
+ _new_(o) {
2731
2791
  this.set("url", this.get("basePath") + this.get("configFileName"));
2732
2792
  }
2733
2793
  });
2734
2794
 
2735
- Class("VO", Object, {});
2795
+ Class("VO", ClassFactory("InheritClass"), {});
2736
2796
 
2737
2797
  /**
2738
2798
  * Returns a standarized uri for a component
@@ -2741,7 +2801,7 @@
2741
2801
  * @author: Jean Machuca <correojean@gmail.com>
2742
2802
  * @param params an object with the params to build the uri path
2743
2803
  */
2744
- var ComponentURI = function(params) {
2804
+ var ComponentURI = function (params) {
2745
2805
  var templateURI = "";
2746
2806
  if (params["TPL_SOURCE"] === "default") {
2747
2807
  templateURI = "{{COMPONENTS_BASE_PATH}}{{COMPONENT_NAME}}.{{TPLEXTENSION}}";
@@ -2759,13 +2819,13 @@
2759
2819
  * @author: Jean Machuca <correojean@gmail.com>
2760
2820
  * @param component a Component object
2761
2821
  */
2762
- var componentLoader = function(component, _async) {
2763
- var _componentLoaderInBrowser = function(component, _async) {
2764
- component.__promise__ = new Promise(function(resolve, reject) {
2822
+ var componentLoader = function (component, _async) {
2823
+ var _componentLoaderInBrowser = function (component, _async) {
2824
+ component.__promise__ = new Promise(function (resolve, reject) {
2765
2825
  var _promise = component.__promise__;
2766
- var container = (Object.hasOwnProperty.call(component,"container") && typeof component.container !== "undefined" && component.container !== null) ? (component.container) : (component.body);
2826
+ var container = (Object.hasOwnProperty.call(component, "container") && typeof component.container !== "undefined" && component.container !== null) ? (component.container) : (component.body);
2767
2827
  if (container !== null) {
2768
- var _feedComponent_ = function(component) {
2828
+ var _feedComponent_ = function (component) {
2769
2829
  component.feedComponent();
2770
2830
  var standardResponse = {
2771
2831
  "request": xhr,
@@ -2775,7 +2835,7 @@
2775
2835
  };
2776
2836
  logger.debug("LOADING COMPONENT DATA {{DATA}} FROM {{URL}}".replace("{{DATA}}", _DataStringify(component.data)).replace("{{URL}}", component.url));
2777
2837
 
2778
- var _componentLoaded = function() {
2838
+ var _componentLoaded = function () {
2779
2839
  var successStatus = (is_file) ? (0) : (200);
2780
2840
  if (xhr.status === successStatus) {
2781
2841
  var response = xhr.responseText;
@@ -2795,27 +2855,27 @@
2795
2855
 
2796
2856
  }
2797
2857
  };
2798
- if (typeof component.template === "string" && component.template !== ""){
2858
+ if (typeof component.template === "string" && component.template !== "") {
2799
2859
  // component already has a template it does not need to be reloaded
2800
2860
  _feedComponent_.call(this, component);
2801
2861
  } else {
2802
2862
  var is_file = (component.url.startsWith("file:")) ? (true) : (false);
2803
2863
  var xhr = new XMLHttpRequest();
2804
- if (!is_file){
2864
+ if (!is_file) {
2805
2865
  try {
2806
2866
  logger.debug("Calling the url of component in async mode.");
2807
2867
  xhr.open(component.method, component.url, true);
2808
- } catch (e){
2868
+ } catch (e) {
2809
2869
  logger.debug("Last try has failed... The component cannot be loaded.");
2810
2870
  }
2811
2871
  } else {
2812
- if ("fetch" in _top){
2872
+ if ("fetch" in _top) {
2813
2873
  logger.debug("I can use fetch...");
2814
2874
  logger.debug("It is a file to be loaded, so I will try to use fetch");
2815
- var _p = fetch (component.url).then(response=>{
2875
+ var _p = fetch(component.url).then(response => {
2816
2876
  logger.debug("I got a response from fetch, so I'll feed the component");
2817
- response.text().then(text=>{
2818
- component.template=text;
2877
+ response.text().then(text => {
2878
+ component.template = text;
2819
2879
  _feedComponent_.call(this, component);
2820
2880
  });
2821
2881
  });
@@ -2827,11 +2887,11 @@
2827
2887
  if (!is_file) {
2828
2888
  xhr.onload = _componentLoaded;
2829
2889
  }
2830
- var _directLoad = function(is_file) {
2831
- is_file = (typeof is_file === "undefined" || !is_file)?(false):(true);
2890
+ var _directLoad = function (is_file) {
2891
+ is_file = (typeof is_file === "undefined" || !is_file) ? (false) : (true);
2832
2892
  logger.debug("SENDING THE NORMAL REQUEST ");
2833
2893
  if (is_file) {
2834
- if(!("fetch" in _top)){
2894
+ if (!("fetch" in _top)) {
2835
2895
  logger.debug("I have to try to load the file using xhr... ");
2836
2896
  xhr.send(null);
2837
2897
  if (xhr.status === XMLHttpRequest.DONE) {
@@ -2848,15 +2908,15 @@
2848
2908
  logger.debug("USING CACHE FOR COMPONENT: " + component.name);
2849
2909
  var cache = new ComplexStorageCache({
2850
2910
  index: component.cacheIndex,
2851
- load (cacheController) {
2852
- _directLoad.call(this,is_file);
2911
+ load(cacheController) {
2912
+ _directLoad.call(this, is_file);
2853
2913
  },
2854
- alternate (cacheController) {
2914
+ alternate(cacheController) {
2855
2915
  if (component.method === "GET") {
2856
2916
  component.template = cacheController.cache.getCached(component.cacheIndex);
2857
2917
  _feedComponent_.call(this, component);
2858
2918
  } else {
2859
- _directLoad.call(this,is_file);
2919
+ _directLoad.call(this, is_file);
2860
2920
  }
2861
2921
  return;
2862
2922
  }
@@ -2864,7 +2924,7 @@
2864
2924
  global.lastCache = cache;
2865
2925
  } else {
2866
2926
  logger.debug("NOT USING CACHE FOR COMPONENT: " + component.name);
2867
- _directLoad.call(this,is_file);
2927
+ _directLoad.call(this, is_file);
2868
2928
  }
2869
2929
 
2870
2930
  }
@@ -2874,112 +2934,112 @@
2874
2934
  logger.debug("CONTAINER DOESNT EXIST");
2875
2935
  }
2876
2936
  });
2877
- component.__promise__.then(function(standardResponse) {
2937
+ component.__promise__.then(function (standardResponse) {
2878
2938
  var _ret_;
2879
2939
  if (typeof component.done === "function") {
2880
2940
  _ret_ = component.done.call(component, standardResponse);
2881
2941
  }
2882
2942
  return Promise.resolve(_ret_);
2883
- }, function(standardResponse) {
2943
+ }, function (standardResponse) {
2884
2944
  var _ret_;
2885
2945
  if (typeof component.fail === "function") {
2886
2946
  _ret_ = component.fail.call(component, standardResponse);
2887
2947
  }
2888
2948
  return Promise.reject(_ret_);
2889
- }).catch(function(e) {
2949
+ }).catch(function (e) {
2890
2950
  logger.debug("Something wrong loading the component");
2891
2951
  });
2892
2952
  return component.__promise__;
2893
2953
  };
2894
- var _componentLoaderInNode = function(component, _async) {
2895
- component.__promise__ = new Promise(function(resolve, reject) {
2896
- var _promise = component.__promise__;
2897
- var _feedComponent_ = function(component) {
2898
- component.feedComponent();
2899
- var standardResponse = {
2900
- "request": null,
2901
- "component": component
2902
- };
2903
- resolve.call(_promise, standardResponse);
2954
+ var _componentLoaderInNode = function (component, _async) {
2955
+ component.__promise__ = new Promise(function (resolve, reject) {
2956
+ var _promise = component.__promise__;
2957
+ var _feedComponent_ = function (component) {
2958
+ component.feedComponent();
2959
+ var standardResponse = {
2960
+ "request": null,
2961
+ "component": component
2904
2962
  };
2905
- logger.debug("LOADING COMPONENT DATA {{DATA}} FROM {{URL}}".replace("{{DATA}}", _DataStringify(component.data)).replace("{{URL}}", component.url));
2906
-
2907
- var _componentLoaded = function(err, responseText) {
2908
- if (!err) {
2909
- var response = responseText.toString();
2910
- logger.debug("Data received {{DATA}}".replace("{{DATA}}", _DataStringify(response)));
2911
- logger.debug("CREATING COMPONENT {{NAME}}".replace("{{NAME}}", component.name));
2912
- component.template = response;
2913
- if (component.cached && (typeof cache !== "undefined")) {
2914
- cache.save(component.name, component.template);
2915
- }
2916
- _feedComponent_.call(this, component);
2917
- } else {
2918
- var standardResponse = {
2919
- "request": null,
2920
- "component": component
2921
- };
2922
- reject.call(_promise, standardResponse);
2963
+ resolve.call(_promise, standardResponse);
2964
+ };
2965
+ logger.debug("LOADING COMPONENT DATA {{DATA}} FROM {{URL}}".replace("{{DATA}}", _DataStringify(component.data)).replace("{{URL}}", component.url));
2966
+
2967
+ var _componentLoaded = function (err, responseText) {
2968
+ if (!err) {
2969
+ var response = responseText.toString();
2970
+ logger.debug("Data received {{DATA}}".replace("{{DATA}}", _DataStringify(response)));
2971
+ logger.debug("CREATING COMPONENT {{NAME}}".replace("{{NAME}}", component.name));
2972
+ component.template = response;
2973
+ if (component.cached && (typeof cache !== "undefined")) {
2974
+ cache.save(component.name, component.template);
2923
2975
  }
2924
- };
2925
- if (typeof component.template === "string" && component.template !== ""){
2926
- // component already has a template it does not need to be reloaded
2927
2976
  _feedComponent_.call(this, component);
2928
2977
  } else {
2929
- logger.debug("Loading the component as a local file in server...");
2930
- var _directLoad = function(is_file) {
2931
- const fs = require("fs");
2932
- logger.debug("SENDING THE NORMAL REQUEST ");
2933
- fs.readFile(component.url, _componentLoaded);
2978
+ var standardResponse = {
2979
+ "request": null,
2980
+ "component": component
2934
2981
  };
2982
+ reject.call(_promise, standardResponse);
2983
+ }
2984
+ };
2985
+ if (typeof component.template === "string" && component.template !== "") {
2986
+ // component already has a template it does not need to be reloaded
2987
+ _feedComponent_.call(this, component);
2988
+ } else {
2989
+ logger.debug("Loading the component as a local file in server...");
2990
+ var _directLoad = function (is_file) {
2991
+ const fs = require("fs");
2992
+ logger.debug("SENDING THE NORMAL REQUEST ");
2993
+ fs.readFile(component.url, _componentLoaded);
2994
+ };
2935
2995
 
2936
- if (component.cached ) {
2937
- logger.debug("USING CACHE FOR COMPONENT: " + component.name);
2938
- var cache = new ComplexStorageCache({
2939
- index: component.cacheIndex,
2940
- load (cacheController) {
2996
+ if (component.cached) {
2997
+ logger.debug("USING CACHE FOR COMPONENT: " + component.name);
2998
+ var cache = new ComplexStorageCache({
2999
+ index: component.cacheIndex,
3000
+ load(cacheController) {
3001
+ _directLoad.call(this);
3002
+ },
3003
+ alternate(cacheController) {
3004
+ if (component.method === "GET") {
3005
+ component.template = cacheController.cache.getCached(component.cacheIndex);
3006
+ _feedComponent_.call(this, component);
3007
+ } else {
2941
3008
  _directLoad.call(this);
2942
- },
2943
- alternate (cacheController) {
2944
- if (component.method === "GET") {
2945
- component.template = cacheController.cache.getCached(component.cacheIndex);
2946
- _feedComponent_.call(this, component);
2947
- } else {
2948
- _directLoad.call(this);
2949
- }
2950
- return;
2951
3009
  }
2952
- });
2953
- global.lastCache = cache;
2954
- } else {
2955
- logger.debug("NOT USING CACHE FOR COMPONENT: " + component.name);
2956
- _directLoad.call(this);
2957
- }
2958
-
3010
+ return;
3011
+ }
3012
+ });
3013
+ global.lastCache = cache;
3014
+ } else {
3015
+ logger.debug("NOT USING CACHE FOR COMPONENT: " + component.name);
3016
+ _directLoad.call(this);
2959
3017
  }
2960
3018
 
2961
- return;
3019
+ }
3020
+
3021
+ return;
2962
3022
  });
2963
- component.__promise__.then(function(standardResponse) {
3023
+ component.__promise__.then(function (standardResponse) {
2964
3024
  var _ret_;
2965
3025
  if (typeof component.done === "function") {
2966
3026
  _ret_ = component.done.call(component, standardResponse);
2967
3027
  }
2968
3028
  return Promise.resolve(_ret_);
2969
- }, function(standardResponse) {
3029
+ }, function (standardResponse) {
2970
3030
  var _ret_;
2971
3031
  if (typeof component.fail === "function") {
2972
3032
  _ret_ = component.fail.call(component, standardResponse);
2973
3033
  }
2974
3034
  return Promise.reject(_ret_);
2975
- }).catch(function(e) {
3035
+ }).catch(function (e) {
2976
3036
  logger.debug("Something wrong loading the component");
2977
3037
  });
2978
3038
  return component.__promise__;
2979
3039
  };
2980
3040
 
2981
3041
  var _ret_;
2982
- if (isBrowser){
3042
+ if (isBrowser) {
2983
3043
  if (typeof _async !== "undefined" && _async) {
2984
3044
  _ret_ = asyncLoad(_componentLoaderInBrowser, arguments);
2985
3045
  } else {
@@ -2997,10 +3057,10 @@
2997
3057
  * @author: Jean Machuca <correojean@gmail.com>
2998
3058
  * @param service a Service object
2999
3059
  */
3000
- var serviceLoader = function(service, _async) {
3001
- var _serviceLoaderInBrowser = function(service, _async) {
3060
+ var serviceLoader = function (service, _async) {
3061
+ var _serviceLoaderInBrowser = function (service, _async) {
3002
3062
  var _promise = new Promise(
3003
- function(resolve, reject) {
3063
+ function (resolve, reject) {
3004
3064
 
3005
3065
  logger.debug("LOADING SERVICE DATA {{DATA}} FROM {{URL}}".replace("{{DATA}}", _DataStringify(service.data)).replace("{{URL}}", service.url));
3006
3066
  var xhr = new XMLHttpRequest();
@@ -3009,14 +3069,14 @@
3009
3069
  xhr.open(service.method, service.url, xhrasync);
3010
3070
  for (var header in service.headers) {
3011
3071
  try {
3012
- if (typeof service.headers[header] !== "function"){
3072
+ if (typeof service.headers[header] !== "function") {
3013
3073
  xhr.setRequestHeader(header, service.headers[header]);
3014
3074
  }
3015
- } catch (e){
3016
- logger.debug("Something went wrong when assign the header "+header);
3075
+ } catch (e) {
3076
+ logger.debug("Something went wrong when assign the header " + header);
3017
3077
  }
3018
3078
  }
3019
- xhr.onload = function() {
3079
+ xhr.onload = function () {
3020
3080
  if (xhr.status === 200) {
3021
3081
  var response = xhr.responseText;
3022
3082
  logger.debug("Data received {{DATA}}".replace("{{DATA}}", _DataStringify(response)));
@@ -3045,7 +3105,7 @@
3045
3105
  }
3046
3106
  };
3047
3107
 
3048
- var _directLoad = function() {
3108
+ var _directLoad = function () {
3049
3109
  logger.debug("SENDING THE NORMAL REQUEST ");
3050
3110
  try {
3051
3111
  xhr.send(_DataStringify(service.data));
@@ -3061,10 +3121,10 @@
3061
3121
  if (service.cached) {
3062
3122
  var cache = new ComplexStorageCache({
3063
3123
  index: service.data,
3064
- load (cacheController) {
3124
+ load(cacheController) {
3065
3125
  _directLoad.call(this);
3066
3126
  },
3067
- alternate (cacheController) {
3127
+ alternate(cacheController) {
3068
3128
  if (service.method === "GET") {
3069
3129
  service.template = cacheController.cache.getCached(service.name);
3070
3130
  if (typeof service.done === "function") {
@@ -3092,19 +3152,19 @@
3092
3152
  return _promise;
3093
3153
  };
3094
3154
 
3095
- var _serviceLoaderInNode = function(service, _async) {
3155
+ var _serviceLoaderInNode = function (service, _async) {
3096
3156
  var _promise = new Promise(
3097
- function(resolve, reject) {
3157
+ function (resolve, reject) {
3098
3158
  if (typeof URL === "undefined") {
3099
3159
  global.URL = require("url").URL;
3100
3160
  let URL = global.URL;
3101
- }
3161
+ }
3102
3162
  var serviceURL = new URL(service.url);
3103
3163
  var req;
3104
- service.useHTTP2 = Object.hasOwnProperty.call(service,"useHTTP2") && service.useHTTP2;
3164
+ service.useHTTP2 = Object.hasOwnProperty.call(service, "useHTTP2") && service.useHTTP2;
3105
3165
 
3106
3166
 
3107
- var captureEvents = function (req){
3167
+ var captureEvents = function (req) {
3108
3168
  logger.debug("LOADING SERVICE DATA (non-browser) {{DATA}} FROM {{URL}}".replace("{{DATA}}", _DataStringify(service.data)).replace("{{URL}}", service.url));
3109
3169
  var dataXML;
3110
3170
  var standardResponse = {
@@ -3114,20 +3174,20 @@
3114
3174
  "responseHeaders": null
3115
3175
  };
3116
3176
 
3117
- if (typeof service.data === "object" && service.data !== null){
3118
- if (service.useHTTP2){
3177
+ if (typeof service.data === "object" && service.data !== null) {
3178
+ if (service.useHTTP2) {
3119
3179
  try {
3120
3180
  logger.debug("Sending data...");
3121
3181
  let buffer = new Buffer(_DataStringify(service.data));
3122
3182
  req.write(buffer);
3123
- }catch (e){
3183
+ } catch (e) {
3124
3184
  logger.debug("It was not possible to send any data");
3125
3185
  }
3126
3186
  }
3127
3187
  }
3128
3188
 
3129
3189
  dataXML = "";
3130
- req.on("response", (responseHeaders,flags) => {
3190
+ req.on("response", (responseHeaders, flags) => {
3131
3191
  logger.debug("receiving response...");
3132
3192
  standardResponse.responseHeaders = responseHeaders;
3133
3193
  /*
@@ -3140,16 +3200,16 @@
3140
3200
  req.on("data", (chunk) => {
3141
3201
  logger.debug("receiving data...");
3142
3202
  // do something with the data
3143
- dataXML += ""+ chunk.toString();
3203
+ dataXML += "" + chunk.toString();
3144
3204
  service.template = dataXML;
3145
3205
  });
3146
- if (service.useHTTP2){
3206
+ if (service.useHTTP2) {
3147
3207
  req.resume();
3148
3208
  }
3149
3209
  req.on("end", () => {
3150
3210
  logger.debug("ending call...");
3151
3211
  service.template = dataXML;
3152
- if (Object.hasOwnProperty.call(service,"useHTTP2") && service.useHTTP2) {
3212
+ if (Object.hasOwnProperty.call(service, "useHTTP2") && service.useHTTP2) {
3153
3213
  client.destroy();
3154
3214
  } else {
3155
3215
  req.destroy();
@@ -3157,7 +3217,7 @@
3157
3217
  service.done.call(service, standardResponse);
3158
3218
  resolve.call(_promise, standardResponse);
3159
3219
  });
3160
- if (service.useHTTP2){
3220
+ if (service.useHTTP2) {
3161
3221
  req.end();
3162
3222
  }
3163
3223
 
@@ -3173,12 +3233,12 @@
3173
3233
  ":method": service.method,
3174
3234
  ":path": serviceURL.pathname
3175
3235
  }, service.options);
3176
- requestOptions = Object.assign(requestOptions,service.headers);
3236
+ requestOptions = Object.assign(requestOptions, service.headers);
3177
3237
  req = client.request(requestOptions);
3178
3238
  req.setEncoding("utf8");
3179
3239
  captureEvents(req);
3180
3240
  } else {
3181
- if (serviceURL.protocol === "http:"){
3241
+ if (serviceURL.protocol === "http:") {
3182
3242
  var http = require("http");
3183
3243
  var request = http.request;
3184
3244
  requestOptions = Object.assign({
@@ -3187,7 +3247,7 @@
3187
3247
  }, service.options);
3188
3248
  var req = request(service.url);
3189
3249
  captureEvents(req);
3190
- } else if (serviceURL.protocol === "https:"){
3250
+ } else if (serviceURL.protocol === "https:") {
3191
3251
  var https = require("https");
3192
3252
  requestOptions = Object.assign({
3193
3253
  hostname: serviceURL.hostname,
@@ -3196,14 +3256,14 @@
3196
3256
  method: service.method,
3197
3257
  headers: service.headers
3198
3258
  }, service.options);
3199
- var _req_ = https.request(requestOptions, function (req){
3259
+ var _req_ = https.request(requestOptions, function (req) {
3200
3260
  captureEvents(req);
3201
3261
  });
3202
3262
  _req_.end();
3203
3263
  } else {
3204
- var e = "Protocol not supported: "+serviceURL.protocol;
3264
+ var e = "Protocol not supported: " + serviceURL.protocol;
3205
3265
  logger.debug(e);
3206
- throw new Error (e);
3266
+ throw new Error(e);
3207
3267
  }
3208
3268
  }
3209
3269
 
@@ -3214,18 +3274,18 @@
3214
3274
  reject.call(_promise, e);
3215
3275
 
3216
3276
  }
3217
- }).catch(function(e) {
3218
- console.log(e);
3219
- logger.debug("Something happened when trying to call the service: " + service.name);
3220
- service.fail.call(service, e);
3277
+ }).catch(function (e) {
3278
+ console.log(e);
3279
+ logger.debug("Something happened when trying to call the service: " + service.name);
3280
+ service.fail.call(service, e);
3221
3281
  });
3222
3282
  return _promise;
3223
3283
 
3224
3284
  };
3225
3285
 
3226
- var _serviceLoaderMockup = function(service, _async) {
3286
+ var _serviceLoaderMockup = function (service, _async) {
3227
3287
  var _promise = new Promise(
3228
- function(resolve, reject) {
3288
+ function (resolve, reject) {
3229
3289
  logger.debug(`Calling mockup service ${service.name} ...`);
3230
3290
  var standardResponse = {
3231
3291
  "request": null,
@@ -3241,8 +3301,8 @@
3241
3301
  });
3242
3302
  return _promise;
3243
3303
  };
3244
- var _serviceLoaderLocal = function(service, _async) {
3245
- var _promise = new Promise (
3304
+ var _serviceLoaderLocal = function (service, _async) {
3305
+ var _promise = new Promise(
3246
3306
  function (resolve, reject) {
3247
3307
  logger.debug(`Calling local service ${service.name} ...`);
3248
3308
  var standardResponse = {
@@ -3294,425 +3354,221 @@
3294
3354
  Export(isQCObjects_Object);
3295
3355
  Export(NamespaceRef);
3296
3356
 
3297
- asyncLoad(function() {
3298
3357
 
3299
- Class("GlobalSettings", Object, {
3300
- _GLOBAL: {},
3301
- set (name, value) {
3302
- this._GLOBAL[name] = value;
3303
- },
3304
- get (name,_default) {
3305
- var _value;
3306
- if (typeof this._GLOBAL[name] !== "undefined"){
3307
- _value = this._GLOBAL[name];
3308
- } else if (typeof _default !== "undefined"){
3309
- _value = _default;
3310
- }
3311
- return _value;
3312
- },
3313
- __start__ () {
3314
- var __load__serviceWorker = function() {
3315
- var _promise;
3316
- if (isBrowser) {
3317
- _promise = new Promise(function(resolve, reject) {
3318
- if (("serviceWorker" in navigator) &&
3319
- (typeof _top.CONFIG.get("serviceWorkerURI") !== "undefined")) {
3320
- _top.CONFIG.set("serviceWorkerScope", _top.CONFIG.get("serviceWorkerScope") ? (_top.CONFIG.get("serviceWorkerScope")) : ("/"));
3321
- navigator.serviceWorker.register(_top.CONFIG.get("serviceWorkerURI"), {
3322
- scope: _top.CONFIG.get("serviceWorkerScope")
3323
- })
3324
- .then(function(registration) {
3325
- logger.debug("Service Worker Registered");
3326
- resolve.call(_promise, registration);
3327
- }, function(registration) {
3328
- logger.debug("Error registering Service Worker");
3329
- reject.call(_promise, registration);
3330
- });
3331
- navigator.serviceWorker.ready.then(function(registration) {
3332
- logger.debug("Service Worker Ready");
3333
- resolve.call(_promise, registration);
3334
- }, function(registration) {
3335
- logger.debug("Error loading Service Worker");
3336
- reject.call(_promise, registration);
3337
- });
3358
+ if (isBrowser) {
3359
+
3360
+ Element.prototype.buildComponents = function (rebuildObjects = false) {
3361
+ var tagFilter = (!rebuildObjects) ? ("component:not([loaded])") : ("component");
3362
+ var d = this;
3363
+ var _buildComponent = function (components, __parent__) {
3364
+ var componentsBuiltWith = components.map(function (_component_, _c) {
3365
+ _component_ = components[_c];
3366
+ var data = {};
3367
+ var attributenames = components[_c].getAttributeNames().filter(function (a) {
3368
+ return a.startsWith("data-");
3369
+ }).map(function (a) {
3370
+ return a.split("-")[1];
3371
+ });
3372
+ attributenames.map(function (_attribute_name_) {
3373
+ data[_attribute_name_] = components[_c].getAttribute("data-" + _attribute_name_);
3374
+ });
3375
+ var componentDone = function () {
3376
+ var _component_ = this;
3377
+ if (typeof _component_ === "undefined") {
3378
+ throw new Error("componentDone() has lost its context");
3379
+ }
3380
+ if (typeof _component_.body === "undefined") {
3381
+ throw new Error("The component has no body");
3382
+ }
3383
+ var viewName = _component_.body.getAttribute("viewClass");
3384
+ var _View = ClassFactory(viewName);
3385
+ if (typeof _View !== "undefined") {
3386
+ _component_.view = New(_View, {
3387
+ component: _component_
3388
+ }); // Initializes the main view for the component
3389
+ if (Object.hasOwnProperty.call(_component_.view, "done") && typeof _component_.view.done === "function") {
3390
+ _component_.view.done.call(_component_.view);
3338
3391
  }
3339
- });
3392
+ }
3393
+ var controllerName = _component_.body.getAttribute("controllerClass");
3394
+ if (!controllerName) {
3395
+ controllerName = "Controller";
3396
+ }
3397
+ var _Controller = ClassFactory(controllerName);
3398
+ if (typeof _Controller !== "undefined") {
3399
+ _component_.controller = New(_Controller, {
3400
+ component: _component_
3401
+ }); // Initializes the main controller for the component
3402
+ if (Object.hasOwnProperty.call(_component_.controller, "done") && typeof _component_.controller.done === "function") {
3403
+ _component_.controller.done.call(_component_.controller);
3404
+ }
3405
+ if (Object.hasOwnProperty.call(_component_.controller, "createRoutingController")) {
3406
+ _component_.controller.createRoutingController.call(_component_.controller);
3407
+ }
3408
+ }
3409
+ var effectClassName = _component_.body.getAttribute("effectClass");
3410
+ var applyEffectTo = _component_.body.getAttribute("apply-effect-to");
3411
+ applyEffectTo = (applyEffectTo !== null) ? (applyEffectTo) : ("load");
3412
+ if (effectClassName !== null && applyEffectTo === "observe") {
3413
+ _component_.applyObserveTransitionEffect(effectClassName);
3414
+ } else if (effectClassName !== null && applyEffectTo === "load") {
3415
+ _component_.applyTransitionEffect(effectClassName);
3416
+ }
3417
+ if (_component_.shadowed && (typeof _component_.shadowRoot !== "undefined")) {
3418
+ _component_.subcomponents = _buildComponent(_component_.shadowRoot.subelements(tagFilter), _component_);
3419
+ } else {
3420
+ _component_.subcomponents = _buildComponent(_component_.body.subelements(tagFilter), _component_);
3421
+ }
3422
+
3423
+ if (_top.CONFIG.get("overrideComponentTag")) {
3424
+ _component_.body.outerHTML = this.body.innerHTML;
3425
+ }
3426
+ _component_.body.setAttribute("loaded", true);
3427
+
3428
+ _component_.runComponentHelpers();
3429
+
3430
+ if ((Tag("component[loaded=true]").length * 100 / Tag("component").length) >= 100) {
3431
+ d.dispatchEvent(new CustomEvent("componentsloaded", {
3432
+ detail: {
3433
+ lastComponent: _component_
3434
+ }
3435
+ }));
3436
+ }
3437
+ };
3438
+
3439
+ var __shadowed_not_set = (components[_c].getAttribute("shadowed") === null) ? (true) : (false);
3440
+ var __tplsource_attr_not_set = (components[_c].getAttribute("template-source") === null) ? (true) : (false);
3441
+ var shadowed = (components[_c].getAttribute("shadowed") === "true") ? (true) : (false);
3442
+ var __cached_not_set = (components[_c].getAttribute("cached") === null) ? (true) : (false);
3443
+ var cached = (components[_c].getAttribute("cached") === "true") ? (true) : (false);
3444
+ var tplextension = (typeof _top.CONFIG.get("tplextension") !== "undefined") ? (_top.CONFIG.get("tplextension")) : ("html");
3445
+ tplextension = (components[_c].getAttribute("tplextension") !== null) ? (components[_c].getAttribute("tplextension")) : (tplextension);
3446
+ var _componentName = components[_c].getAttribute("name");
3447
+ var _componentClassName = (components[_c].getAttribute("componentClass") !== null) ? (components[_c].getAttribute("componentClass")) : ("Component");
3448
+ var _serviceClassName = (components[_c].getAttribute("serviceClass") !== null) ? (components[_c].getAttribute("serviceClass")) : (null);
3449
+ /* __enable_service_class__ = true by default */
3450
+ var __enable_service_class__ = (
3451
+ (Object.hasOwnProperty.call(components[_c], "enableServiceClass") && components[_c].enableServiceClass) ||
3452
+ (!Object.hasOwnProperty.call(components[_c], "enableServiceClass"))
3453
+ ) ? (true) : (false);
3454
+ var _response_to_data_ = (components[_c].getAttribute("response-to") !== null && components[_c].getAttribute("response-to") === "data") ? (true) : (false);
3455
+ var _response_to_template_ = (components[_c].getAttribute("response-to") !== null && components[_c].getAttribute("response-to") === "template") ? (true) : (false);
3456
+ let __componentClassName = (_top.CONFIG.get("preserveComponentBodyTag")) ? (
3457
+ (_componentName !== null) ? ("com.qcobjects.components." + _componentName + ".ComponentBody") : ("com.qcobjects.components.ComponentBody")
3458
+ ) : (_componentClassName);
3459
+ _componentName = (_componentName !== null) ? (_componentName) : (
3460
+ (ClassFactory(__componentClassName) &&
3461
+ typeof ClassFactory(__componentClassName).name !== "undefined"
3462
+ ) ? (
3463
+ ClassFactory(__componentClassName).name
3464
+ ) : ("")
3465
+ );
3466
+ var __classDefinition = ClassFactory(__componentClassName);
3467
+ var __tplsource_prop_set = (__componentClassName !== "Component" && ((typeof __classDefinition !== "undefined" && typeof __classDefinition.tplsource === "string") && __classDefinition.tplsource !== "")) ? (true) : (false);
3468
+ var tplsource = (__tplsource_attr_not_set && __tplsource_prop_set) ? (__classDefinition.tplsource) : ((__tplsource_attr_not_set) ? ("default") : (components[_c].getAttribute("template-source")));
3469
+ logger.debug(`template source for ${_componentName} is ${tplsource} `);
3470
+ logger.debug(`type for ${_componentName} is ${__getType__(__classDefinition)} `);
3471
+
3472
+ var componentURI;
3473
+ componentURI = ComponentURI({
3474
+ "COMPONENTS_BASE_PATH": _top.CONFIG.get("componentsBasePath"),
3475
+ "COMPONENT_NAME": _componentName,
3476
+ "TPLEXTENSION": tplextension,
3477
+ "TPL_SOURCE": tplsource
3478
+ });
3479
+ if (_top.CONFIG.get("preserveComponentBodyTag")) {
3480
+ Package((_componentName !== "") ? ("com.qcobjects.components." + _componentName + "") : ("com.qcobjects.components"), [
3481
+ Class("ComponentBody", ClassFactory("Component"), {
3482
+ name: _componentName,
3483
+ tplsource: tplsource,
3484
+ tplextension: tplextension,
3485
+ reload: true
3486
+ })
3487
+ ]);
3340
3488
  }
3341
- return _promise;
3342
- };
3343
- var _buildComponents = function() {
3344
- if (isBrowser) {
3345
- logger.debug("Starting to bind routes");
3346
- _top._bindroute_.call(ClassFactory("Component"));
3347
- logger.debug("Starting to building components");
3348
- global.componentsStack = document.buildComponents.call(document);
3349
- logger.debug("Initializing the service worker");
3350
- __load__serviceWorker.call(_top).catch(function() {
3351
- logger.debug("error loading the service worker");
3352
- });
3353
3489
 
3490
+ var __serviceClass;
3491
+ if (__enable_service_class__ && _serviceClassName !== null) {
3492
+ __serviceClass = ClassFactory(_serviceClassName);
3354
3493
  }
3355
- };
3356
- logger.debug("Starting to load the config settings...");
3357
- if (_top.CONFIG.get("useConfigService", false)) {
3358
- logger.debug("Loading settings using local configuration file...");
3359
- _top.global.configService = New(ClassFactory("ConfigService"));
3360
- _top.global.configService.configLoaded = _buildComponents;
3361
- serviceLoader(_top.global.configService);
3362
- } else {
3363
- logger.debug("Starting to load the components...");
3364
- _buildComponents.call(this);
3365
- }
3366
- }
3367
- });
3368
- var _g_ = New(ClassFactory("GlobalSettings"));
3369
-
3370
- Object.defineProperty(global,"PackagesNameList",{
3371
- set(val){
3372
- logger.debug("PackagesNameList is readonly");
3373
- return;
3374
- },
3375
- get(){
3376
- var _get_packages_names = function (_packages){
3377
- var _keys = [];
3378
- for (var _k in _packages){
3379
- if (
3380
- typeof _packages[_k] !== "undefined"
3381
- && typeof _packages[_k] !== "function"
3382
- && Object.hasOwnProperty.call(_packages[_k],"length")
3383
- && _packages[_k].length>0
3384
- ){
3385
- _keys.push(_k);
3386
- _keys = _keys.concat(_get_packages_names(_packages[_k]));
3387
- }
3388
- }
3389
- return _keys;
3390
- };
3391
- return _get_packages_names(_QC_PACKAGES);
3392
- }
3393
- });
3394
-
3395
- Object.defineProperty(global,"PackagesList",{
3396
- set(value){
3397
- logger.debug("PackagesList is readonly");
3398
- return;
3399
- },
3400
- get(){
3401
- return global.PackagesNameList.map(function (packagename) {
3402
- let _classesList = Package(packagename);
3403
- let _ret_;
3404
- if (_classesList){
3405
- _ret_ = {
3406
- packageName:packagename,
3407
- classesList:_classesList.filter(function (_packageClass) {
3408
- return isQCObjects_Class(_packageClass);
3409
- }
3410
- )
3411
- };
3494
+ if (!_response_to_data_ && __classDefinition && Object.hasOwnProperty.call(__classDefinition, "responseTo")) {
3495
+ _response_to_data_ = (__classDefinition.responseTo === "data") ? (true) : (false);
3496
+ } else if (!_response_to_data_ && Object.hasOwnProperty.call(ClassFactory("Component"), "responseTo")) {
3497
+ _response_to_data_ = (ClassFactory("Component").responseTo === "data") ? (true) : (false);
3412
3498
  }
3413
- return _ret_;
3414
- }).filter(function (_p){return typeof _p !== "undefined";});
3415
- }
3416
- });
3417
-
3418
- Object.defineProperty(global,"ClassesList",{
3419
- set(value){
3420
- logger.debug("ClassesList is readonly");
3421
- return;
3422
- },
3423
- get(){
3424
- var _classesList = [];
3425
- global.PackagesList.map(function (_package_element){
3426
- _classesList = _classesList.concat(_package_element.classesList.map(
3427
- function (_class_element){
3428
- return {
3429
- packageName:_package_element.packageName,
3430
- className:_package_element.packageName+"."+_class_element.__definition.__classType,
3431
- classFactory:_class_element
3432
- };
3433
- }
3434
- ));
3435
- return _package_element;
3436
- });
3437
-
3438
- return _classesList;
3439
- }
3440
- });
3441
-
3442
- Object.defineProperty(global,"ClassesNameList",{
3443
- set(value){
3444
- logger.debug("ClassesNameList is readonly");
3445
- return;
3446
- },
3447
- get(){
3448
- return global.ClassesList.map(function (_class_element) {
3449
- return _class_element.className;
3450
- });
3451
- }
3452
- });
3453
-
3454
- _top = _CastProps(_g_, _top);
3455
-
3456
- if (isBrowser) {
3457
- // use of GLOBAL word is deprecated in node.js
3458
- // this is only for compatibility purpose with old versions of QCObjects in browsers
3459
- Class("GLOBAL", _QC_CLASSES["global"]); // case insensitive for compatibility con old versions;
3460
- Export(ClassFactory("GLOBAL"));
3461
- }
3462
- Export(global);
3463
-
3464
-
3465
- if (_top.CONFIG.get("useSDK")) {
3466
- (function() {
3467
- var remoteImportsPath = _top.CONFIG.get("remoteImportsPath");
3468
- var external = (!_top.CONFIG.get("useLocalSDK")) ? (true) : (false);
3469
- _top.CONFIG.set("remoteImportsPath", _top.CONFIG.get("remoteSDKPath"));
3470
-
3471
- var tryImportingSDK = false;
3472
- var sdkName = "QCObjects-SDK";
3473
- if (isBrowser) {
3474
- tryImportingSDK = true;
3475
- } else {
3476
- var sdkPath = findPackageNodePath("qcobjects-sdk");
3477
- if (sdkPath !== null) {
3478
- sdkName = "qcobjects-sdk";
3479
- tryImportingSDK = true;
3480
- } else {
3481
- sdkName = "node_modules/qcobjects-sdk/QCObjects-SDK";
3482
- tryImportingSDK = true;
3499
+ if (!_response_to_template_ && __classDefinition && Object.hasOwnProperty.call(__classDefinition, "responseTo")) {
3500
+ _response_to_template_ = (__classDefinition.responseTo === "template") ? (true) : (false);
3501
+ } else if (!_response_to_template_ && Object.hasOwnProperty.call(ClassFactory("Component"), "responseTo")) {
3502
+ _response_to_template_ = (ClassFactory("Component").responseTo === "template") ? (true) : (false);
3483
3503
  }
3484
- }
3485
3504
 
3486
- if (tryImportingSDK) {
3487
- logger.info("Importing SDK... " + sdkName);
3488
- Import(sdkName, function() {
3489
- if (external) {
3490
- logger.debug("QCObjects-SDK.js loaded from remote location");
3491
- } else {
3492
- logger.debug("QCObjects-SDK.js loaded from local");
3493
- }
3494
- _top.CONFIG.set("remoteImportsPath", remoteImportsPath);
3495
- }, external);
3496
- } else {
3497
- logger.debug("SDK has not been imported as it is not available at the moment");
3498
- }
3499
- }).call(null);
3500
- }
3501
-
3502
-
3503
- }, null);
3504
-
3505
- if (isBrowser) {
3506
-
3507
- Element.prototype.buildComponents = function(rebuildObjects = false) {
3508
- var tagFilter = (!rebuildObjects) ? ("component:not([loaded])") : ("component");
3509
- var d = this;
3510
- var _buildComponent = function(components, __parent__) {
3511
- var componentsBuiltWith = components.map (function (_component_, _c){
3512
- _component_ = components[_c];
3513
- var data = {};
3514
- var attributenames = components[_c].getAttributeNames().filter(function(a) {
3515
- return a.startsWith("data-");
3516
- }).map(function(a) {
3517
- return a.split("-")[1];
3518
- });
3519
- attributenames.map(function (_attribute_name_){
3520
- data[_attribute_name_] = components[_c].getAttribute("data-" + _attribute_name_);
3521
- });
3522
- var componentDone = function() {
3523
- var _component_ = this;
3524
- if (typeof _component_ === "undefined") {
3525
- throw new Error("componentDone() has lost its context");
3526
- }
3527
- if (typeof _component_.body === "undefined") {
3528
- throw new Error("The component has no body");
3529
- }
3530
- var viewName = _component_.body.getAttribute("viewClass");
3531
- var _View = ClassFactory(viewName);
3532
- if (typeof _View !== "undefined") {
3533
- _component_.view = New(_View, {
3534
- component: _component_
3535
- }); // Initializes the main view for the component
3536
- if (Object.hasOwnProperty.call(_component_.view,"done") && typeof _component_.view.done === "function") {
3537
- _component_.view.done.call(_component_.view);
3538
- }
3539
- }
3540
- var controllerName = _component_.body.getAttribute("controllerClass");
3541
- if (!controllerName){
3542
- controllerName = "Controller";
3543
- }
3544
- var _Controller = ClassFactory(controllerName);
3545
- if (typeof _Controller !== "undefined") {
3546
- _component_.controller = New(_Controller, {
3547
- component: _component_
3548
- }); // Initializes the main controller for the component
3549
- if (Object.hasOwnProperty.call(_component_.controller,"done") && typeof _component_.controller.done === "function") {
3550
- _component_.controller.done.call(_component_.controller);
3551
- }
3552
- if (Object.hasOwnProperty.call(_component_.controller,"createRoutingController")){
3553
- _component_.controller.createRoutingController.call(_component_.controller);
3554
- }
3555
- }
3556
- var effectClassName = _component_.body.getAttribute("effectClass");
3557
- var applyEffectTo = _component_.body.getAttribute("apply-effect-to");
3558
- applyEffectTo = (applyEffectTo !== null)?(applyEffectTo):("load");
3559
- if (effectClassName !== null && applyEffectTo === "observe"){
3560
- _component_.applyObserveTransitionEffect(effectClassName);
3561
- } else if (effectClassName !== null && applyEffectTo === "load"){
3562
- _component_.applyTransitionEffect(effectClassName);
3563
- }
3564
- if (_component_.shadowed && (typeof _component_.shadowRoot !== "undefined")){
3565
- _component_.subcomponents = _buildComponent(_component_.shadowRoot.subelements(tagFilter), _component_);
3566
- } else {
3567
- _component_.subcomponents = _buildComponent(_component_.body.subelements(tagFilter), _component_);
3568
- }
3569
-
3570
- if (_top.CONFIG.get("overrideComponentTag")) {
3571
- _component_.body.outerHTML = this.body.innerHTML;
3572
- }
3573
- _component_.body.setAttribute("loaded", true);
3574
-
3575
- _component_.runComponentHelpers();
3576
-
3577
- if ((Tag("component[loaded=true]").length * 100 / Tag("component").length) >= 100) {
3578
- d.dispatchEvent(new CustomEvent("componentsloaded", {
3579
- detail: {
3580
- lastComponent: _component_
3581
- }
3582
- }));
3583
- }
3505
+ var __create_component_instance_ = function (data, serviceResponse) {
3506
+ var __shadowed = (__shadowed_not_set) ? ((__classDefinition && __classDefinition.shadowed) || ClassFactory("Component").shadowed) : (shadowed);
3507
+ var __definition = {
3508
+ __parent__: __parent__,
3509
+ name: _componentName,
3510
+ data: data,
3511
+ cached: (__cached_not_set) ? (ClassFactory("Component").cached) : (cached),
3512
+ shadowed: __shadowed,
3513
+ tplextension: tplextension,
3514
+ body: (_top.CONFIG.get("preserveComponentBodyTag")) ? (_DOMCreateElement("componentBody")) : (components[_c]),
3515
+ templateURI: componentURI,
3516
+ tplsource: tplsource,
3517
+ subcomponents: []
3584
3518
  };
3585
-
3586
- var __shadowed_not_set = (components[_c].getAttribute("shadowed") === null) ? (true) : (false);
3587
- var __tplsource_attr_not_set = (components[_c].getAttribute("template-source") === null) ? (true) : (false);
3588
- var shadowed = (components[_c].getAttribute("shadowed") === "true") ? (true) : (false);
3589
- var __cached_not_set = (components[_c].getAttribute("cached") === null) ? (true) : (false);
3590
- var cached = (components[_c].getAttribute("cached") === "true") ? (true) : (false);
3591
- var tplextension = (typeof _top.CONFIG.get("tplextension") !== "undefined") ? (_top.CONFIG.get("tplextension")) : ("html");
3592
- tplextension = (components[_c].getAttribute("tplextension") !== null) ? (components[_c].getAttribute("tplextension")) : (tplextension);
3593
- var _componentName = components[_c].getAttribute("name");
3594
- var _componentClassName = (components[_c].getAttribute("componentClass") !== null) ? (components[_c].getAttribute("componentClass")) : ("Component");
3595
- var _serviceClassName = (components[_c].getAttribute("serviceClass") !== null) ? (components[_c].getAttribute("serviceClass")) : (null);
3596
- /* __enable_service_class__ = true by default */
3597
- var __enable_service_class__ = (
3598
- (Object.hasOwnProperty.call(components[_c], "enableServiceClass") && components[_c].enableServiceClass)
3599
- || (!Object.hasOwnProperty.call(components[_c], "enableServiceClass"))
3600
- ) ? (true) : (false);
3601
- var _response_to_data_ = (components[_c].getAttribute("response-to") !== null && components[_c].getAttribute("response-to") === "data") ? (true) : (false);
3602
- var _response_to_template_ = (components[_c].getAttribute("response-to") !== null && components[_c].getAttribute("response-to") === "template") ? (true) : (false);
3603
- let __componentClassName = (_top.CONFIG.get("preserveComponentBodyTag"))?(
3604
- (_componentName !== null)?("com.qcobjects.components."+_componentName+".ComponentBody"):("com.qcobjects.components.ComponentBody")
3605
- ):(_componentClassName);
3606
- _componentName = (_componentName !== null)?(_componentName):(
3607
- (ClassFactory(__componentClassName)
3608
- && typeof ClassFactory(__componentClassName).name !== "undefined"
3609
- )?(
3610
- ClassFactory(__componentClassName).name
3611
- ):("")
3612
- );
3613
- var __classDefinition = ClassFactory(__componentClassName);
3614
- var __tplsource_prop_set = (__componentClassName !== "Component" && ((typeof __classDefinition !== "undefined" && typeof __classDefinition.tplsource === "string") && __classDefinition.tplsource !== "") ) ? (true) : (false);
3615
- var tplsource = (__tplsource_attr_not_set && __tplsource_prop_set) ? (__classDefinition.tplsource) : ((__tplsource_attr_not_set)?("default"):(components[_c].getAttribute("template-source")));
3616
- logger.debug (`template source for ${_componentName} is ${tplsource} `);
3617
- logger.debug (`type for ${_componentName} is ${__getType__(__classDefinition)} `);
3618
-
3619
- var componentURI;
3620
- componentURI = ComponentURI({
3621
- "COMPONENTS_BASE_PATH": _top.CONFIG.get("componentsBasePath"),
3622
- "COMPONENT_NAME": _componentName,
3623
- "TPLEXTENSION": tplextension,
3624
- "TPL_SOURCE": tplsource
3625
- });
3626
- if (_top.CONFIG.get("preserveComponentBodyTag")) {
3627
- Package((_componentName !== "")?("com.qcobjects.components."+_componentName+""):("com.qcobjects.components"),[
3628
- Class("ComponentBody", ClassFactory("Component"), {
3629
- name: _componentName,
3630
- tplsource:tplsource,
3631
- tplextension:tplextension,
3632
- reload: true
3633
- })
3634
- ]);
3635
- }
3636
-
3637
- var __serviceClass;
3638
- if (__enable_service_class__ && _serviceClassName !== null) {
3639
- __serviceClass = ClassFactory(_serviceClassName);
3519
+ if (_response_to_template_) {
3520
+ __definition.template = serviceResponse;
3640
3521
  }
3641
- if (!_response_to_data_ && __classDefinition && Object.hasOwnProperty.call(__classDefinition, "responseTo")){
3642
- _response_to_data_ = (__classDefinition.responseTo === "data")?(true):(false);
3643
- } else if (!_response_to_data_ && Object.hasOwnProperty.call(ClassFactory("Component"), "responseTo")){
3644
- _response_to_data_ = (ClassFactory("Component").responseTo === "data")?(true):(false);
3522
+ if (typeof _componentName === "undefined" || _componentName === "" || _componentName === null) {
3523
+ /* this allows to use the original property defined
3524
+ in the component definition if it is not present in the tag */
3525
+ delete __definition.name;
3645
3526
  }
3646
- if (!_response_to_template_ && __classDefinition && Object.hasOwnProperty.call(__classDefinition, "responseTo")){
3647
- _response_to_template_ = (__classDefinition.responseTo === "template")?(true):(false);
3648
- } else if (!_response_to_template_ && Object.hasOwnProperty.call(ClassFactory("Component"), "responseTo")){
3649
- _response_to_template_ = (ClassFactory("Component").responseTo === "template")?(true):(false);
3527
+ if (componentURI === "") {
3528
+ /* this allows to use the original property defined
3529
+ in the component definition if it is not present in the tag */
3530
+ delete __definition.templateURI;
3650
3531
  }
3532
+ var newComponent = New(__classDefinition, __definition);
3651
3533
 
3652
- var __create_component_instance_ = function (data, serviceResponse) {
3653
- var __shadowed = (__shadowed_not_set) ? ((__classDefinition && __classDefinition.shadowed) || ClassFactory("Component").shadowed) : (shadowed);
3654
- var __definition = {
3655
- __parent__:__parent__,
3656
- name: _componentName,
3657
- data: data,
3658
- cached: (__cached_not_set) ? (ClassFactory("Component").cached) : (cached),
3659
- shadowed: __shadowed,
3660
- tplextension: tplextension,
3661
- body: (_top.CONFIG.get("preserveComponentBodyTag")) ? (_DOMCreateElement("componentBody")):(components[_c]),
3662
- templateURI: componentURI,
3663
- tplsource: tplsource,
3664
- subcomponents: []
3665
- };
3666
- if (_response_to_template_){
3667
- __definition.template = serviceResponse;
3668
- }
3669
- if (typeof _componentName === "undefined" || _componentName === "" || _componentName === null){
3670
- /* this allows to use the original property defined
3671
- in the component definition if it is not present in the tag */
3672
- delete __definition.name;
3673
- }
3674
- if (componentURI === ""){
3675
- /* this allows to use the original property defined
3676
- in the component definition if it is not present in the tag */
3677
- delete __definition.templateURI;
3678
- }
3679
- var newComponent = New(__classDefinition, __definition);
3680
-
3681
- if (_top.CONFIG.get("preserveComponentBodyTag")) {
3682
- components[_c].append(newComponent);
3683
- }
3684
- newComponent.done = componentDone;
3685
- return newComponent;
3686
- };
3687
- var newComponent;
3688
- if (typeof __serviceClass !== "undefined"
3689
- && (typeof __enable_service_class__ !== "undefined"
3690
- && __enable_service_class__ === true)
3691
- && (_response_to_data_ || _response_to_template_)
3692
- ){
3693
- logger.info("Loading service "+_serviceClassName);
3694
- var serviceInstance = New(__serviceClass, {
3695
- data: data
3696
- });
3697
- serviceLoader(serviceInstance).then(function ({request, service}){
3698
- var serviceResponse = service.template;
3699
- if (_response_to_data_){
3700
- if (typeof data === "object" && typeof serviceResponse === "object"){
3701
- data = Object.assign(data, serviceResponse);
3702
- } else {
3703
- data = serviceResponse;
3704
- }
3705
- }
3706
- newComponent = __create_component_instance_.call(this, data, serviceResponse);
3707
- newComponent.serviceInstance = serviceInstance;
3708
- newComponent.serviceData = data;
3709
- }).catch (function (e){
3710
- logger.debug("Something went wroing while trying to load the service "+_serviceClassName);
3711
- });
3712
- } else {
3713
- newComponent = __create_component_instance_.call(this, data, null);
3534
+ if (_top.CONFIG.get("preserveComponentBodyTag")) {
3535
+ components[_c].append(newComponent);
3714
3536
  }
3537
+ newComponent.done = componentDone;
3715
3538
  return newComponent;
3539
+ };
3540
+ var newComponent;
3541
+ if (typeof __serviceClass !== "undefined" &&
3542
+ (typeof __enable_service_class__ !== "undefined" &&
3543
+ __enable_service_class__ === true) &&
3544
+ (_response_to_data_ || _response_to_template_)
3545
+ ) {
3546
+ logger.info("Loading service " + _serviceClassName);
3547
+ var serviceInstance = New(__serviceClass, {
3548
+ data: data
3549
+ });
3550
+ serviceLoader(serviceInstance).then(function ({
3551
+ request,
3552
+ service
3553
+ }) {
3554
+ var serviceResponse = service.template;
3555
+ if (_response_to_data_) {
3556
+ if (typeof data === "object" && typeof serviceResponse === "object") {
3557
+ data = Object.assign(data, serviceResponse);
3558
+ } else {
3559
+ data = serviceResponse;
3560
+ }
3561
+ }
3562
+ newComponent = __create_component_instance_.call(this, data, serviceResponse);
3563
+ newComponent.serviceInstance = serviceInstance;
3564
+ newComponent.serviceData = data;
3565
+ }).catch(function (e) {
3566
+ logger.debug("Something went wroing while trying to load the service " + _serviceClassName);
3567
+ });
3568
+ } else {
3569
+ newComponent = __create_component_instance_.call(this, data, null);
3570
+ }
3571
+ return newComponent;
3716
3572
  });
3717
3573
  return componentsBuiltWith;
3718
3574
  };
@@ -3727,28 +3583,28 @@
3727
3583
  const componentWidget = this;
3728
3584
  const componentName = componentWidget.nodeName.toLowerCase();
3729
3585
  const componentBody = _DOMCreateElement("component");
3730
- const __enabled__atributes__ = ["cached","splashscreen","response-to","shadowed","componentClass", "controllerClass", "viewClass", "serviceClass", "effectClass", "tplextension", "template-source", "data"];
3731
- componentBody.setAttribute("name",componentName);
3586
+ const __enabled__atributes__ = ["cached", "splashscreen", "response-to", "shadowed", "componentClass", "controllerClass", "viewClass", "serviceClass", "effectClass", "tplextension", "template-source", "data"];
3587
+ componentBody.setAttribute("name", componentName);
3732
3588
 
3733
3589
  if (!componentWidget.hasAttribute("shadowed")) {
3734
- componentBody.setAttribute("shadowed","true");
3590
+ componentBody.setAttribute("shadowed", "true");
3735
3591
  }
3736
- __enabled__atributes__.map (function (attributeName){
3737
- if (componentWidget.hasAttribute(attributeName)){
3738
- componentBody.setAttribute(attributeName,componentWidget.getAttribute(attributeName));
3592
+ __enabled__atributes__.map(function (attributeName) {
3593
+ if (componentWidget.hasAttribute(attributeName)) {
3594
+ componentBody.setAttribute(attributeName, componentWidget.getAttribute(attributeName));
3739
3595
  componentWidget.removeAttribute(attributeName);
3740
3596
  }
3741
3597
  });
3742
- var data_attributenames = componentWidget.getAttributeNames().filter(function(a) {
3598
+ var data_attributenames = componentWidget.getAttributeNames().filter(function (a) {
3743
3599
  return a.startsWith("data-");
3744
- }).map(function(a) {
3600
+ }).map(function (a) {
3745
3601
  return a.split("-")[1];
3746
3602
  });
3747
- data_attributenames.map(function (_attribute_name_){
3603
+ data_attributenames.map(function (_attribute_name_) {
3748
3604
  componentBody.setAttribute("data-" + _attribute_name_, componentWidget.getAttribute("data-" + _attribute_name_));
3749
3605
  componentWidget.removeAttribute("data-" + _attribute_name_);
3750
3606
  });
3751
- [...componentWidget.children].map(function (element){
3607
+ [...componentWidget.children].map(function (element) {
3752
3608
  componentBody.appendChild(element.cloneNode(true));
3753
3609
  element.remove();
3754
3610
  });
@@ -3757,12 +3613,14 @@
3757
3613
  }
3758
3614
  };
3759
3615
  Export(_ComponentWidget_);
3760
- var RegisterWidget = function (widgetName){
3761
- customElements.define(widgetName,class extends _ComponentWidget_ {});
3616
+ var RegisterWidget = function (widgetName) {
3617
+ customElements.define(widgetName, class extends _ComponentWidget_ {});
3762
3618
  };
3763
- var RegisterWidgets = function (){
3619
+ var RegisterWidgets = function () {
3764
3620
  var widgetList = [...arguments];
3765
- widgetList.filter(function (widgetName){return typeof widgetName === "string";}).map(function (widgetName){
3621
+ widgetList.filter(function (widgetName) {
3622
+ return typeof widgetName === "string";
3623
+ }).map(function (widgetName) {
3766
3624
  RegisterWidget(widgetName);
3767
3625
  });
3768
3626
  };
@@ -3783,16 +3641,21 @@
3783
3641
  body: null,
3784
3642
  stream: null,
3785
3643
  request: null,
3786
- cors (){
3787
- if (this.route.cors){
3788
- let {allow_origins,allow_credentials,allow_methods,allow_headers} = this.route.cors;
3644
+ cors() {
3645
+ if (this.route.cors) {
3646
+ let {
3647
+ allow_origins,
3648
+ allow_credentials,
3649
+ allow_methods,
3650
+ allow_headers
3651
+ } = this.route.cors;
3789
3652
  var microservice = this;
3790
- if (typeof microservice.headers !== "object"){
3653
+ if (typeof microservice.headers !== "object") {
3791
3654
  microservice.headers = {};
3792
3655
  }
3793
- if (typeof allow_origins !== "undefined"){
3656
+ if (typeof allow_origins !== "undefined") {
3794
3657
  // an example of allow_origins is ['https://example.com','http://www.example.com']
3795
- if (allow_origins === "*" || (typeof microservice.request.headers.origin === "undefined") || [...allow_origins].indexOf(microservice.request.headers.origin)!== -1){
3658
+ if (allow_origins === "*" || (typeof microservice.request.headers.origin === "undefined") || [...allow_origins].indexOf(microservice.request.headers.origin) !== -1) {
3796
3659
  // for compatibility with all browsers allways return a wildcard when the origin is allowed
3797
3660
  microservice.headers["Access-Control-Allow-Origin"] = "*";
3798
3661
  } else {
@@ -3801,29 +3664,29 @@
3801
3664
  this.body = {};
3802
3665
  try {
3803
3666
  this.done();
3804
- } catch (e){}
3667
+ } catch (e) {}
3805
3668
  }
3806
3669
  } else {
3807
3670
  microservice.headers["Access-Control-Allow-Origin"] = "*";
3808
3671
  }
3809
- if (typeof allow_credentials !== "undefined"){
3672
+ if (typeof allow_credentials !== "undefined") {
3810
3673
  microservice.headers["Access-Control-Allow-Credentials"] = allow_credentials.toString();
3811
3674
  } else {
3812
3675
  microservice.headers["Access-Control-Allow-Credentials"] = "true";
3813
3676
  }
3814
- if (typeof allow_methods !== "undefined"){
3677
+ if (typeof allow_methods !== "undefined") {
3815
3678
  microservice.headers["Access-Control-Allow-Methods"] = [...allow_methods].join(",");
3816
3679
  } else {
3817
3680
  microservice.headers["Access-Control-Allow-Methods"] = "GET, OPTIONS, POST";
3818
3681
  }
3819
- if (typeof allow_headers !== "undefined"){
3682
+ if (typeof allow_headers !== "undefined") {
3820
3683
  microservice.headers["Access-Control-Allow-Headers"] = [...allow_headers].join(",");
3821
3684
  } else {
3822
3685
  microservice.headers["Access-Control-Allow-Headers"] = "*";
3823
3686
  }
3824
3687
  }
3825
3688
  },
3826
- _new_ (o) {
3689
+ _new_(o) {
3827
3690
  logger.debug("Executing BackendMicroservice ");
3828
3691
  let microservice = this;
3829
3692
  microservice.body = null;
@@ -3837,7 +3700,7 @@
3837
3700
  var supportedMethods = {
3838
3701
  "post": microservice.post,
3839
3702
  };
3840
- if (Object.hasOwnProperty.call(supportedMethods,requestMethod)) {
3703
+ if (Object.hasOwnProperty.call(supportedMethods, requestMethod)) {
3841
3704
  supportedMethods[requestMethod].call(microservice, data);
3842
3705
  }
3843
3706
  });
@@ -3854,39 +3717,39 @@
3854
3717
  "trace": microservice.trace,
3855
3718
  "patch": microservice.patch
3856
3719
  };
3857
- if (Object.hasOwnProperty.call(supportedMethods,requestMethod)) {
3720
+ if (Object.hasOwnProperty.call(supportedMethods, requestMethod)) {
3858
3721
  supportedMethods[requestMethod].call(microservice);
3859
3722
  }
3860
3723
 
3861
3724
  },
3862
- head (formData) {
3725
+ head(formData) {
3863
3726
  this.done();
3864
3727
  },
3865
- get (formData){
3728
+ get(formData) {
3866
3729
  this.done();
3867
3730
  },
3868
- post (formData) {
3731
+ post(formData) {
3869
3732
  this.done();
3870
3733
  },
3871
- put (formData) {
3734
+ put(formData) {
3872
3735
  this.done();
3873
3736
  },
3874
- delete (formData) {
3737
+ delete(formData) {
3875
3738
  this.done();
3876
3739
  },
3877
- connect (formData) {
3740
+ connect(formData) {
3878
3741
  this.done();
3879
3742
  },
3880
- options (formData) {
3743
+ options(formData) {
3881
3744
  this.done();
3882
3745
  },
3883
- trace (formData) {
3746
+ trace(formData) {
3884
3747
  this.done();
3885
3748
  },
3886
- patch (formData) {
3749
+ patch(formData) {
3887
3750
  this.done();
3888
3751
  },
3889
- finishWithBody (stream) {
3752
+ finishWithBody(stream) {
3890
3753
  try {
3891
3754
  stream.write(_DataStringify(this.body));
3892
3755
  stream.end();
@@ -3894,18 +3757,18 @@
3894
3757
  logger.debug("Something wrong writing the response for microservice" + e.toString());
3895
3758
  }
3896
3759
  },
3897
- done () {
3760
+ done() {
3898
3761
  var microservice = this;
3899
3762
  var stream = microservice.stream;
3900
3763
  try {
3901
3764
  stream.respond(microservice.headers);
3902
- } catch (e){
3765
+ } catch (e) {
3903
3766
  logger.debug(e.toString());
3904
3767
  }
3905
3768
  if (microservice.body !== null) {
3906
3769
  try {
3907
3770
  microservice.finishWithBody.call(microservice, stream);
3908
- } catch (e){
3771
+ } catch (e) {
3909
3772
  logger.debug(e.toString());
3910
3773
  }
3911
3774
  }
@@ -3924,34 +3787,34 @@
3924
3787
  data: {},
3925
3788
  async: false,
3926
3789
  external: false,
3927
- set (name, value) {
3790
+ set(name, value) {
3928
3791
  this[name] = value;
3929
3792
  },
3930
- get (name) {
3793
+ get(name) {
3931
3794
  return this[name];
3932
3795
  },
3933
3796
  status: false,
3934
- done () {},
3935
- fail () {},
3936
- rebuild () {
3797
+ done() {},
3798
+ fail() {},
3799
+ rebuild() {
3937
3800
  var context = this;
3938
3801
  try {
3939
3802
  document.getElementsByTagName(context.containerTag)[0].appendChild(
3940
- (function(s, url, context) {
3803
+ (function (s, url, context) {
3941
3804
  s.type = context.type;
3942
3805
  s.src = url;
3943
- s.crossOrigin = (Object.hasOwnProperty.call(context,"crossOrigin")) ? (context.crossOrigin) : ("anonymous");
3806
+ s.crossOrigin = (Object.hasOwnProperty.call(context, "crossOrigin")) ? (context.crossOrigin) : ("anonymous");
3944
3807
  s.async = context.async;
3945
- s.onreadystatechange = function() {
3808
+ s.onreadystatechange = function () {
3946
3809
  if (this.readyState === "complete") {
3947
3810
  context.done.call(context);
3948
3811
  }
3949
3812
  };
3950
- s.onload = function(e) {
3813
+ s.onload = function (e) {
3951
3814
  context.status = true;
3952
3815
  context.done.call(context, e);
3953
3816
  };
3954
- s.onerror = function(e) {
3817
+ s.onerror = function (e) {
3955
3818
  context.status = false;
3956
3819
  context.fail.call(context, e);
3957
3820
  };
@@ -3965,10 +3828,10 @@
3965
3828
  context.fail.call(context, e);
3966
3829
  }
3967
3830
  },
3968
- Cast (o) {
3831
+ Cast(o) {
3969
3832
  return _Cast(this, o);
3970
3833
  },
3971
- _new_ (properties) {
3834
+ _new_(properties) {
3972
3835
  this.__new__(properties);
3973
3836
  this.rebuild();
3974
3837
  }
@@ -3981,23 +3844,23 @@
3981
3844
  data: {},
3982
3845
  async: false,
3983
3846
  external: false,
3984
- set (name, value) {
3847
+ set(name, value) {
3985
3848
  this[name] = value;
3986
3849
  },
3987
- get (name) {
3850
+ get(name) {
3988
3851
  return this[name];
3989
3852
  },
3990
- done () {},
3991
- rebuild () {
3853
+ done() {},
3854
+ rebuild() {
3992
3855
  var context = this;
3993
- if (isBrowser){
3856
+ if (isBrowser) {
3994
3857
  window.document.getElementsByTagName("head")[0].appendChild(
3995
- (function(s, url, context) {
3858
+ (function (s, url, context) {
3996
3859
  s.type = "text/css";
3997
3860
  s.rel = "stylesheet";
3998
3861
  s.href = url;
3999
3862
  s.crossOrigin = "anonymous";
4000
- s.onreadystatechange = function() {
3863
+ s.onreadystatechange = function () {
4001
3864
  if (this.readyState === "complete") {
4002
3865
  context.done.call(context);
4003
3866
  }
@@ -4010,144 +3873,183 @@
4010
3873
  (this.external) ? (this.url) : (this.basePath + this.url), context));
4011
3874
  }
4012
3875
  },
4013
- Cast (o) {
3876
+ Cast(o) {
4014
3877
  return _Cast(this, o);
4015
3878
  },
4016
- _new_ (properties) {
3879
+ _new_(properties) {
4017
3880
  this.__new__(properties);
4018
3881
  this.rebuild();
4019
3882
  }
4020
3883
  });
4021
3884
 
4022
3885
  /**
4023
- * Array math functions
4024
- */
4025
- var __to_number = function(value) {
3886
+ * Array math functions
3887
+ */
3888
+ var __to_number = function (value) {
4026
3889
  return (isNaN(value)) ? (new Number(0)) : (new Number(value));
4027
3890
  };
4028
- Array.prototype.unique = function() {
4029
- return this.filter(function (value, index, self) { return self.indexOf(value) === index;});
3891
+ Array.prototype.unique = function () {
3892
+ return this.filter(function (value, index, self) {
3893
+ return self.indexOf(value) === index;
3894
+ });
4030
3895
  };
4031
- Array.unique = function (a){
3896
+ Array.unique = function (a) {
4032
3897
  return a.unique();
4033
3898
  };
4034
3899
  (_protected_code_)(Array.unique);
4035
3900
  (_protected_code_)(Array.prototype.unique);
4036
- Array.prototype.table = function() {
3901
+ Array.prototype.table = function () {
4037
3902
  console.table(this);
4038
3903
  };
4039
- Array.table = function (a){
3904
+ Array.table = function (a) {
4040
3905
  return a.table();
4041
3906
  };
4042
3907
  (_protected_code_)(Array.table);
4043
3908
  (_protected_code_)(Array.prototype.table);
4044
- Array.prototype.sum = function() {
4045
- return this.reduce(function(prev, current) {
3909
+ Array.prototype.sum = function () {
3910
+ return this.reduce(function (prev, current) {
4046
3911
  return __to_number(prev) + __to_number(current);
4047
- },0);
3912
+ }, 0);
4048
3913
  };
4049
- Array.sum = function (a){
3914
+ Array.sum = function (a) {
4050
3915
  return a.sum();
4051
3916
  };
4052
3917
  (_protected_code_)(Array.sum);
4053
3918
  (_protected_code_)(Array.prototype.sum);
4054
- Array.prototype.avg = function() {
4055
- return (this.length<1)?(0):(this.reduce(function(prev, current) {
3919
+ Array.prototype.avg = function () {
3920
+ return (this.length < 1) ? (0) : (this.reduce(function (prev, current) {
4056
3921
  return ((__to_number(prev) + __to_number(current)) / 2);
4057
3922
  }));
4058
3923
  };
4059
- Array.avg = function (a){
3924
+ Array.avg = function (a) {
4060
3925
  return a.avg();
4061
3926
  };
4062
3927
  (_protected_code_)(Array.avg);
4063
3928
  (_protected_code_)(Array.prototype.avg);
4064
- Array.prototype.min = function() {
4065
- return this.reduce(function(prev, current) {
4066
- return ( __to_number(prev)<=__to_number(current) ) ? (prev):(current);
4067
- },Infinity);
3929
+ Array.prototype.min = function () {
3930
+ return this.reduce(function (prev, current) {
3931
+ return (__to_number(prev) <= __to_number(current)) ? (prev) : (current);
3932
+ }, Infinity);
4068
3933
  };
4069
- Array.min = function (a){
3934
+ Array.min = function (a) {
4070
3935
  return a.min();
4071
3936
  };
4072
3937
  (_protected_code_)(Array.min);
4073
3938
  (_protected_code_)(Array.prototype.min);
4074
- Array.prototype.max = function() {
4075
- return this.reduce(function(prev, current) {
4076
- return ( __to_number(prev)>=__to_number(current) ) ? (prev):(current);
4077
- },0);
3939
+ Array.prototype.max = function () {
3940
+ return this.reduce(function (prev, current) {
3941
+ return (__to_number(prev) >= __to_number(current)) ? (prev) : (current);
3942
+ }, 0);
4078
3943
  };
4079
- Array.max = function (a){
3944
+ Array.max = function (a) {
4080
3945
  return a.max();
4081
3946
  };
4082
3947
  (_protected_code_)(Array.max);
4083
3948
  (_protected_code_)(Array.prototype.max);
4084
- Array.prototype.sortBy = function (propName, sortAsc = true){
4085
- var sort_function = (sortAsc)?(
4086
- function (prev, current) { return current[propName] < prev[propName] ? 1 : -1;}
4087
- ):(
4088
- function (prev, current) { return current[propName] > prev[propName] ? 1 : -1;}
3949
+ Array.prototype.sortBy = function (propName, sortAsc = true) {
3950
+ var sort_function = (sortAsc) ? (
3951
+ function (prev, current) {
3952
+ return current[propName] < prev[propName] ? 1 : -1;
3953
+ }
3954
+ ) : (
3955
+ function (prev, current) {
3956
+ return current[propName] > prev[propName] ? 1 : -1;
3957
+ }
4089
3958
  );
4090
3959
  return this.sort(sort_function);
4091
3960
  };
4092
- Array.sortBy = function (a, propName, sortAsc = true){
3961
+ Array.sortBy = function (a, propName, sortAsc = true) {
4093
3962
  return a.sortBy(propName, sortAsc);
4094
3963
  };
4095
3964
  (_protected_code_)(Array.sortBy);
4096
3965
  (_protected_code_)(Array.prototype.sortBy);
4097
3966
 
4098
- Array.matrix = function (_length, _fillValue = 0){
4099
- var x_func = function (x){return _fillValue;};
4100
- return Array.from({length:_length},x_func);
3967
+ Array.matrix = function (_length, _fillValue = 0) {
3968
+ var x_func = function (x) {
3969
+ return _fillValue;
3970
+ };
3971
+ return Array.from({
3972
+ length: _length
3973
+ }, x_func);
4101
3974
  };
4102
3975
  (_protected_code_)(Array.matrix);
4103
3976
 
4104
- Array.matrix2d = function (_length, _fillValue = 0){
4105
- var y_func = function (y){return _fillValue;};
4106
- var x_func = function (x){return Array.from({length:_length},y_func);};
4107
- return Array.from({length:_length},x_func);
3977
+ Array.matrix2d = function (_length, _fillValue = 0) {
3978
+ var y_func = function (y) {
3979
+ return _fillValue;
3980
+ };
3981
+ var x_func = function (x) {
3982
+ return Array.from({
3983
+ length: _length
3984
+ }, y_func);
3985
+ };
3986
+ return Array.from({
3987
+ length: _length
3988
+ }, x_func);
4108
3989
  };
4109
3990
  (_protected_code_)(Array.matrix2d);
4110
3991
 
4111
- Array.matrix3d = function (_length, _fillValue = 0){
4112
- var y_func = function (y){return Array.from({length:_length},function (){return _fillValue;});};
4113
- var x_func = function (x){return Array.from({length:_length},y_func);};
4114
- return Array.from({length:_length},x_func);
3992
+ Array.matrix3d = function (_length, _fillValue = 0) {
3993
+ var y_func = function (y) {
3994
+ return Array.from({
3995
+ length: _length
3996
+ }, function () {
3997
+ return _fillValue;
3998
+ });
3999
+ };
4000
+ var x_func = function (x) {
4001
+ return Array.from({
4002
+ length: _length
4003
+ }, y_func);
4004
+ };
4005
+ return Array.from({
4006
+ length: _length
4007
+ }, x_func);
4115
4008
  };
4116
4009
  (_protected_code_)(Array.matrix3d);
4117
4010
 
4118
- _top.range = function (start, stop=0, step=1) {
4119
- if (stop===0 || typeof stop === "undefined"){
4011
+ _top.range = function (start, stop = 0, step = 1) {
4012
+ if (stop === 0 || typeof stop === "undefined") {
4120
4013
  stop = start;
4121
4014
  start = 0;
4122
4015
  }
4123
- return Array.from({ length: (stop - start) / step + 1}, function (_, i) {return start + (i * step);});
4016
+ return Array.from({
4017
+ length: (stop - start) / step + 1
4018
+ }, function (_, i) {
4019
+ return start + (i * step);
4020
+ });
4124
4021
  };
4125
4022
  (_protected_code_)(_top.range);
4126
4023
 
4127
- String.prototype.list = function () { var __instance=this; return _top.range(0,__instance.length-1).map( function (i) {return __instance[i];}); };
4024
+ String.prototype.list = function () {
4025
+ var __instance = this;
4026
+ return _top.range(0, __instance.length - 1).map(function (i) {
4027
+ return __instance[i];
4028
+ });
4029
+ };
4128
4030
  (_protected_code_)(String.prototype.list);
4129
4031
 
4130
4032
  _top.getDocumentLayout = function () {
4131
4033
  var h = (w, h) => {
4132
- return w>h ? "landscape": null;
4034
+ return w > h ? "landscape" : null;
4133
4035
  };
4134
4036
  var v = (w, h) => {
4135
- return h>w ? "portrait": null;
4037
+ return h > w ? "portrait" : null;
4136
4038
  };
4137
4039
  var square = (w, h) => {
4138
- return w===h ? "square": null;
4040
+ return w === h ? "square" : null;
4139
4041
  };
4140
4042
  return [
4141
- h(document.documentElement.clientWidth,document.documentElement.clientHeight),
4142
- v(document.documentElement.clientWidth,document.documentElement.clientHeight),
4143
- square(document.documentElement.clientWidth,document.documentElement.clientHeight)
4144
- ].filter(e=>e!==null).pop();
4043
+ h(document.documentElement.clientWidth, document.documentElement.clientHeight),
4044
+ v(document.documentElement.clientWidth, document.documentElement.clientHeight),
4045
+ square(document.documentElement.clientWidth, document.documentElement.clientHeight)
4046
+ ].filter(e => e !== null).pop();
4145
4047
  };
4146
4048
 
4147
4049
 
4148
4050
  /**
4149
- * End of array math functions
4150
- */
4051
+ * End of array math functions
4052
+ */
4151
4053
 
4152
4054
 
4153
4055
  Class("ArrayList", Array, []);
@@ -4160,31 +4062,31 @@
4160
4062
 
4161
4063
  Class("ArrayCollection", Object, {
4162
4064
  source: New(ClassFactory("ArrayList"), []),
4163
- changed (prop, value) {
4065
+ changed(prop, value) {
4164
4066
  logger.debug("VALUE CHANGED");
4165
4067
  logger.debug(prop);
4166
4068
  logger.debug(value);
4167
4069
  },
4168
- push (value) {
4070
+ push(value) {
4169
4071
  var self = this;
4170
4072
  logger.debug("VALUE ADDED");
4171
4073
  logger.debug(value);
4172
4074
  self.source.push(value);
4173
4075
  },
4174
- pop (value) {
4076
+ pop(value) {
4175
4077
  var self = this;
4176
4078
  logger.debug("VALUE POPPED");
4177
4079
  logger.debug(value);
4178
4080
  self.source.pop(value);
4179
4081
  },
4180
- _new_ (source) {
4082
+ _new_(source) {
4181
4083
  var self = this;
4182
4084
  var _index = 0;
4183
4085
  self.source = New(ClassFactory("ArrayList"), source);
4184
4086
  for (var _k in self.source) {
4185
4087
  if (!isNaN(_k)) {
4186
4088
  logger.debug("binding " + _k.toString());
4187
- (function(_pname) {
4089
+ (function (_pname) {
4188
4090
  Object.defineProperty(self, _pname, {
4189
4091
  set(value) {
4190
4092
  logger.debug("setting " + _pname + "=" + value);
@@ -4211,7 +4113,7 @@
4211
4113
 
4212
4114
  Class("Effect", {
4213
4115
  duration: 1000,
4214
- animate ({
4116
+ animate({
4215
4117
  timing,
4216
4118
  draw,
4217
4119
  duration
@@ -4233,9 +4135,9 @@
4233
4135
  requestAnimationFrame(animate);
4234
4136
  } else {
4235
4137
  // if this is an object with a done method
4236
- if (typeof this !== "undefined"
4237
- && this !== null
4238
- && Object.hasOwnProperty.call(this,"done") &&
4138
+ if (typeof this !== "undefined" &&
4139
+ this !== null &&
4140
+ Object.hasOwnProperty.call(this, "done") &&
4239
4141
  (typeof this.done).toLowerCase() === "function") {
4240
4142
  this.done.call(this);
4241
4143
  }
@@ -4245,59 +4147,59 @@
4245
4147
  }
4246
4148
  });
4247
4149
 
4248
- Class("TransitionEffect",ClassFactory("Effect"),{
4249
- duration:385,
4250
- defaultParams:{
4251
- alphaFrom:0,
4252
- alphaTo:1,
4253
- angleFrom:180,
4254
- angleTo:0,
4255
- radiusFrom:0,
4256
- radiusTo:30,
4257
- scaleFrom:0,
4258
- scaleTo:1
4150
+ Class("TransitionEffect", ClassFactory("Effect"), {
4151
+ duration: 385,
4152
+ defaultParams: {
4153
+ alphaFrom: 0,
4154
+ alphaTo: 1,
4155
+ angleFrom: 180,
4156
+ angleTo: 0,
4157
+ radiusFrom: 0,
4158
+ radiusTo: 30,
4159
+ scaleFrom: 0,
4160
+ scaleTo: 1
4259
4161
  },
4260
- fitToHeight:false,
4261
- fitToWidth:false,
4162
+ fitToHeight: false,
4163
+ fitToWidth: false,
4262
4164
  effects: [],
4263
- _new_ (o){
4165
+ _new_(o) {
4264
4166
  logger.info("DECLARING TransitionEffect ");
4265
4167
  this.component.defaultParams = this.defaultParams;
4266
4168
  },
4267
- apply ({alphaFrom,
4268
- alphaTo,
4269
- angleFrom,
4270
- angleTo,
4271
- radiusFrom,
4272
- radiusTo,
4273
- scaleFrom,
4274
- scaleTo}){
4169
+ apply({
4170
+ alphaFrom,
4171
+ alphaTo,
4172
+ angleFrom,
4173
+ angleTo,
4174
+ radiusFrom,
4175
+ radiusTo,
4176
+ scaleFrom,
4177
+ scaleTo
4178
+ }) {
4275
4179
  var _transition_ = this;
4276
4180
  logger.info("EXECUTING TransitionEffect ");
4277
- if (_transition_.fitToHeight){
4181
+ if (_transition_.fitToHeight) {
4278
4182
  _transition_.component.body.height = _transition_.component.body.offsetParent.scrollHeight;
4279
4183
  }
4280
- if (_transition_.fitToWidth){
4184
+ if (_transition_.fitToWidth) {
4281
4185
  _transition_.component.body.width = _transition_.component.body.offsetParent.scrollWidth;
4282
4186
  }
4283
4187
  _transition_.component.body.style.display = "block";
4284
- _transition_.effects.map(function (effectClassName,eff){
4188
+ _transition_.effects.map(function (effectClassName, eff) {
4285
4189
  var __effectClass__ = ClassFactory(effectClassName);
4286
4190
  var effectObj = new __effectClass__();
4287
4191
  var effectClassMethod = effectObj.apply;
4288
- var args = [_transition_.component.body].concat(Object.values(
4289
- {
4290
- alphaFrom,
4291
- alphaTo,
4292
- angleFrom,
4293
- angleTo,
4294
- radiusFrom,
4295
- radiusTo,
4296
- scaleFrom,
4297
- scaleTo
4298
- }
4299
- ));
4300
- effectClassMethod.apply(_transition_,args);
4192
+ var args = [_transition_.component.body].concat(Object.values({
4193
+ alphaFrom,
4194
+ alphaTo,
4195
+ angleFrom,
4196
+ angleTo,
4197
+ radiusFrom,
4198
+ radiusTo,
4199
+ scaleFrom,
4200
+ scaleTo
4201
+ }));
4202
+ effectClassMethod.apply(_transition_, args);
4301
4203
  });
4302
4204
  }
4303
4205
  });
@@ -4305,7 +4207,7 @@
4305
4207
  Class("Timer", {
4306
4208
  duration: 1000,
4307
4209
  alive: true,
4308
- thread ({
4210
+ thread({
4309
4211
  timing,
4310
4212
  intervalInterceptor,
4311
4213
  duration
@@ -4340,10 +4242,10 @@
4340
4242
  _negative: null,
4341
4243
  _dispatched: null,
4342
4244
  _args: {},
4343
- changeToggle () {
4245
+ changeToggle() {
4344
4246
  this._toggle = (this._toggle) ? (false) : (true);
4345
4247
  },
4346
- _new_ ({
4248
+ _new_({
4347
4249
  positive,
4348
4250
  negative,
4349
4251
  args
@@ -4352,9 +4254,9 @@
4352
4254
  this._negative = negative;
4353
4255
  this._args = args;
4354
4256
  },
4355
- fire () {
4257
+ fire() {
4356
4258
  var toggle = this;
4357
- var _promise = new Promise(function(resolve, reject) {
4259
+ var _promise = new Promise(function (resolve, reject) {
4358
4260
 
4359
4261
  if (typeof toggle._positive === "function" && typeof toggle._negative === "function") {
4360
4262
  if (toggle._inverse) {
@@ -4368,9 +4270,9 @@
4368
4270
  logger.debug("Toggle functions are not declared");
4369
4271
  reject.call(_promise, toggle);
4370
4272
  }
4371
- }).then(function(toggle) {
4273
+ }).then(function (toggle) {
4372
4274
  toggle.changeToggle();
4373
- }).catch(function(e) {
4275
+ }).catch(function (e) {
4374
4276
  logger.debug(e.toString());
4375
4277
  });
4376
4278
  return _promise;
@@ -4378,27 +4280,27 @@
4378
4280
  });
4379
4281
 
4380
4282
  // Set Processors
4381
- (function (_top){
4283
+ (function (_top) {
4382
4284
 
4383
4285
  let mapper = function (componentName, valueName) {
4384
4286
  /*
4385
- * Mapper processor
4386
- * @usage
4387
- * $mapper(<componentName>,<valueName>)
4388
- *
4389
- * Where componentName is the name of the component (same value as in attribute tag name) without quotes
4390
- * and valueName is the name of the variable that contains the value to map, it can be either a property of
4391
- * the component instance, the data object or a global value
4392
- */
4287
+ * Mapper processor
4288
+ * @usage
4289
+ * $mapper(<componentName>,<valueName>)
4290
+ *
4291
+ * Where componentName is the name of the component (same value as in attribute tag name) without quotes
4292
+ * and valueName is the name of the variable that contains the value to map, it can be either a property of
4293
+ * the component instance, the data object or a global value
4294
+ */
4393
4295
 
4394
4296
 
4395
4297
  let globalValue = _top.global.get(valueName);
4396
4298
  let componentValue = this.component.get(valueName);
4397
4299
  let dataValue = this.component.data[valueName];
4398
- let list = (typeof dataValue !== "undefined")?( dataValue ):( (typeof componentValue !== "undefined")?( componentValue ):( globalValue ) );
4300
+ let list = (typeof dataValue !== "undefined") ? (dataValue) : ((typeof componentValue !== "undefined") ? (componentValue) : (globalValue));
4399
4301
  let listItems = "";
4400
- if (typeof list !== "undefined" && typeof list["map"] !== "undefined"){
4401
- listItems = list.map ( function (element) {
4302
+ if (typeof list !== "undefined" && typeof list["map"] !== "undefined") {
4303
+ listItems = list.map(function (element) {
4402
4304
  let dataItems = [...Object.keys(element)].map(k => ` data-${k}="${element[k].toString()}"`).join("");
4403
4305
  return `<component name="${componentName}" ${dataItems} ></component>`;
4404
4306
  }).join("");
@@ -4409,14 +4311,14 @@
4409
4311
  };
4410
4312
  ClassFactory("Processor").setProcessor(mapper);
4411
4313
 
4412
- let layout = function (layoutname, cssfile){
4314
+ let layout = function (layoutname, cssfile) {
4413
4315
  /*
4414
- * Layout processor
4415
- * @usage
4416
- * $layout(<layoutname>, <cssfile>)
4417
- * Where layoutname can be "portrait" or "landscape" without quotes
4418
- * cssfile is the uri for the css file to import
4419
- */
4316
+ * Layout processor
4317
+ * @usage
4318
+ * $layout(<layoutname>, <cssfile>)
4319
+ * Where layoutname can be "portrait" or "landscape" without quotes
4320
+ * cssfile is the uri for the css file to import
4321
+ */
4420
4322
 
4421
4323
  var layout_portrait = `
4422
4324
  /* CSS Document for Mobile Imports */
@@ -4437,25 +4339,33 @@
4437
4339
  @import url("${cssfile}") (aspect-ratio: 3/2) and (min-width:460px);
4438
4340
  `;
4439
4341
  var layout_code = {
4440
- "landscape":layout_landscape,
4441
- "portrait":layout_portrait
4342
+ "landscape": layout_landscape,
4343
+ "portrait": layout_portrait
4442
4344
  };
4443
4345
 
4444
- return (Object.hasOwnProperty.call(layout_code, layoutname))?(layout_code[layoutname]):("");
4346
+ return (Object.hasOwnProperty.call(layout_code, layoutname)) ? (layout_code[layoutname]) : ("");
4445
4347
  };
4446
4348
 
4447
4349
  ClassFactory("Processor").setProcessor(layout);
4448
4350
 
4449
4351
  let component = function () {
4450
4352
  /*
4451
- * component processor
4452
- * @usage
4453
- * $component(name=<name>, componentClass=<componentClass>, ...)
4454
- * Returns a component tag declaration like:
4455
- * <component name=<name> ...></component>
4456
- */
4457
- let arg = [...arguments].map(function (a){ return {[a.split("=")[0]]:a.split("=")[1]};}).reduce(function (k1, k2) {return Object.assign(k1, k2);});
4458
- let attrs = [...Object.keys(arg)].map(function (a) {return `${a}=${arg[a]}`;}).join(" ");
4353
+ * component processor
4354
+ * @usage
4355
+ * $component(name=<name>, componentClass=<componentClass>, ...)
4356
+ * Returns a component tag declaration like:
4357
+ * <component name=<name> ...></component>
4358
+ */
4359
+ let arg = [...arguments].map(function (a) {
4360
+ return {
4361
+ [a.split("=")[0]]: a.split("=")[1]
4362
+ };
4363
+ }).reduce(function (k1, k2) {
4364
+ return Object.assign(k1, k2);
4365
+ });
4366
+ let attrs = [...Object.keys(arg)].map(function (a) {
4367
+ return `${a}=${arg[a]}`;
4368
+ }).join(" ");
4459
4369
  return `<component ${attrs}></component>`;
4460
4370
  };
4461
4371
 
@@ -4463,14 +4373,14 @@
4463
4373
 
4464
4374
  let repeat = function (length, text) {
4465
4375
  /*
4466
- * Repeat processor
4467
- * @usage
4468
- * $repeat(<length>, <text>)
4469
- * Where length is the number of occurrences of text
4470
- */
4376
+ * Repeat processor
4377
+ * @usage
4378
+ * $repeat(<length>, <text>)
4379
+ * Where length is the number of occurrences of text
4380
+ */
4471
4381
  return _top.range(length).map(
4472
4382
  function (index) {
4473
- return text.replace("{{index}}",index.toString());
4383
+ return text.replace("{{index}}", index.toString());
4474
4384
  }
4475
4385
  ).join("");
4476
4386
  };
@@ -4483,7 +4393,7 @@
4483
4393
  /**
4484
4394
  * Load every component tag declared in the body
4485
4395
  **/
4486
- Ready(function() {
4396
+ Ready(function () {
4487
4397
  if (!_top.CONFIG.get("useSDK")) {
4488
4398
  _top.__start__();
4489
4399
  }
@@ -4503,19 +4413,218 @@
4503
4413
  Export(isBrowser);
4504
4414
  Export(_methods_);
4505
4415
 
4506
- if (!isBrowser) {
4507
- if (typeof _top.global !== "undefined" && Object.hasOwnProperty.call(_top.global,"_fireAsyncLoad")) {
4508
- _top.global._fireAsyncLoad.call(this);
4416
+ asyncLoad(function () {
4417
+
4418
+ Class("GlobalSettings", Object, {
4419
+ _GLOBAL: {},
4420
+ set(name, value) {
4421
+ this._GLOBAL[name] = value;
4422
+ },
4423
+ get(name, _default) {
4424
+ var _value;
4425
+ if (typeof this._GLOBAL[name] !== "undefined") {
4426
+ _value = this._GLOBAL[name];
4427
+ } else if (typeof _default !== "undefined") {
4428
+ _value = _default;
4429
+ }
4430
+ return _value;
4431
+ },
4432
+ __start__() {
4433
+ var __load__serviceWorker = function () {
4434
+ var _promise;
4435
+ if (isBrowser) {
4436
+ _promise = new Promise(function (resolve, reject) {
4437
+ if (("serviceWorker" in navigator) &&
4438
+ (typeof _top.CONFIG.get("serviceWorkerURI") !== "undefined")) {
4439
+ _top.CONFIG.set("serviceWorkerScope", _top.CONFIG.get("serviceWorkerScope") ? (_top.CONFIG.get("serviceWorkerScope")) : ("/"));
4440
+ navigator.serviceWorker.register(_top.CONFIG.get("serviceWorkerURI"), {
4441
+ scope: _top.CONFIG.get("serviceWorkerScope")
4442
+ })
4443
+ .then(function (registration) {
4444
+ logger.debug("Service Worker Registered");
4445
+ resolve.call(_promise, registration);
4446
+ }, function (registration) {
4447
+ logger.debug("Error registering Service Worker");
4448
+ reject.call(_promise, registration);
4449
+ });
4450
+ navigator.serviceWorker.ready.then(function (registration) {
4451
+ logger.debug("Service Worker Ready");
4452
+ resolve.call(_promise, registration);
4453
+ }, function (registration) {
4454
+ logger.debug("Error loading Service Worker");
4455
+ reject.call(_promise, registration);
4456
+ });
4457
+ }
4458
+ });
4459
+ }
4460
+ return _promise;
4461
+ };
4462
+ var _buildComponents = function () {
4463
+ if (isBrowser) {
4464
+ logger.debug("Starting to bind routes");
4465
+ _top._bindroute_.call(ClassFactory("Component"));
4466
+ logger.debug("Starting to building components");
4467
+ global.componentsStack = document.buildComponents.call(document);
4468
+ logger.debug("Initializing the service worker");
4469
+ __load__serviceWorker.call(_top).catch(function () {
4470
+ logger.debug("error loading the service worker");
4471
+ });
4472
+
4473
+ }
4474
+ };
4475
+ logger.debug("Starting to load the config settings...");
4476
+ if (_top.CONFIG.get("useConfigService", false)) {
4477
+ logger.debug("Loading settings using local configuration file...");
4478
+ _top.global.configService = New(ClassFactory("ConfigService"));
4479
+ _top.global.configService.configLoaded = _buildComponents;
4480
+ serviceLoader(_top.global.configService);
4481
+ } else {
4482
+ logger.debug("Starting to load the components...");
4483
+ _buildComponents.call(this);
4484
+ }
4485
+ }
4486
+ });
4487
+ var _g_ = New(ClassFactory("GlobalSettings"));
4488
+
4489
+ Object.defineProperty(global, "PackagesNameList", {
4490
+ set(val) {
4491
+ logger.debug("PackagesNameList is readonly");
4492
+ return;
4493
+ },
4494
+ get() {
4495
+ var _get_packages_names = function (_packages) {
4496
+ var _keys = [];
4497
+ for (var _k in _packages) {
4498
+ if (
4499
+ typeof _packages[_k] !== "undefined" &&
4500
+ typeof _packages[_k] !== "function" &&
4501
+ Object.hasOwnProperty.call(_packages[_k], "length") &&
4502
+ _packages[_k].length > 0
4503
+ ) {
4504
+ _keys.push(_k);
4505
+ _keys = _keys.concat(_get_packages_names(_packages[_k]));
4506
+ }
4507
+ }
4508
+ return _keys;
4509
+ };
4510
+ return _get_packages_names(_QC_PACKAGES);
4511
+ }
4512
+ });
4513
+
4514
+ Object.defineProperty(global, "PackagesList", {
4515
+ set(value) {
4516
+ logger.debug("PackagesList is readonly");
4517
+ return;
4518
+ },
4519
+ get() {
4520
+ return global.PackagesNameList.map(function (packagename) {
4521
+ let _classesList = Package(packagename);
4522
+ let _ret_;
4523
+ if (_classesList) {
4524
+ _ret_ = {
4525
+ packageName: packagename,
4526
+ classesList: _classesList.filter(function (_packageClass) {
4527
+ return isQCObjects_Class(_packageClass);
4528
+ })
4529
+ };
4530
+ }
4531
+ return _ret_;
4532
+ }).filter(function (_p) {
4533
+ return typeof _p !== "undefined";
4534
+ });
4535
+ }
4536
+ });
4537
+
4538
+ Object.defineProperty(global, "ClassesList", {
4539
+ set(value) {
4540
+ logger.debug("ClassesList is readonly");
4541
+ return;
4542
+ },
4543
+ get() {
4544
+ var _classesList = [];
4545
+ global.PackagesList.map(function (_package_element) {
4546
+ _classesList = _classesList.concat(_package_element.classesList.map(
4547
+ function (_class_element) {
4548
+ return {
4549
+ packageName: _package_element.packageName,
4550
+ className: _package_element.packageName + "." + _class_element.__definition.__classType,
4551
+ classFactory: _class_element
4552
+ };
4553
+ }
4554
+ ));
4555
+ return _package_element;
4556
+ });
4557
+
4558
+ return _classesList;
4559
+ }
4560
+ });
4561
+
4562
+ Object.defineProperty(global, "ClassesNameList", {
4563
+ set(value) {
4564
+ logger.debug("ClassesNameList is readonly");
4565
+ return;
4566
+ },
4567
+ get() {
4568
+ return global.ClassesList.map(function (_class_element) {
4569
+ return _class_element.className;
4570
+ });
4571
+ }
4572
+ });
4573
+
4574
+ _top = _CastProps(_g_, _top);
4575
+
4576
+ if (isBrowser) {
4577
+ // use of GLOBAL word is deprecated in node.js
4578
+ // this is only for compatibility purpose with old versions of QCObjects in browsers
4579
+ Class("GLOBAL", _QC_CLASSES["global"]); // case insensitive for compatibility con old versions;
4580
+ Export(ClassFactory("GLOBAL"));
4509
4581
  }
4510
- if (typeof _top.global !== "undefined" && Object.hasOwnProperty.call(_top.global,"onload")) {
4511
- _top.global.onload.call(this);
4582
+ Export(global);
4583
+
4584
+ if (_top.CONFIG.get("useSDK")) {
4585
+ (function () {
4586
+ var remoteImportsPath = _top.CONFIG.get("remoteImportsPath");
4587
+ var external = (!_top.CONFIG.get("useLocalSDK")) ? (true) : (false);
4588
+ _top.CONFIG.set("remoteImportsPath", _top.CONFIG.get("remoteSDKPath"));
4589
+
4590
+ var tryImportingSDK = false;
4591
+ var sdkName = "QCObjects-SDK";
4592
+ if (isBrowser) {
4593
+ tryImportingSDK = true;
4594
+ } else {
4595
+ var sdkPath = findPackageNodePath("qcobjects-sdk");
4596
+ if (sdkPath !== null) {
4597
+ sdkName = "qcobjects-sdk";
4598
+ tryImportingSDK = true;
4599
+ } else {
4600
+ sdkName = "node_modules/qcobjects-sdk/QCObjects-SDK";
4601
+ tryImportingSDK = true;
4602
+ }
4603
+ }
4604
+
4605
+ if (tryImportingSDK) {
4606
+ logger.info("Importing SDK... " + sdkName);
4607
+ Import(sdkName, function () {
4608
+ if (external) {
4609
+ logger.debug("QCObjects-SDK.js loaded from remote location");
4610
+ } else {
4611
+ logger.debug("QCObjects-SDK.js loaded from local");
4612
+ }
4613
+ _top.CONFIG.set("remoteImportsPath", remoteImportsPath);
4614
+ }, external);
4615
+ } else {
4616
+ logger.debug("SDK has not been imported as it is not available at the moment");
4617
+ }
4618
+ }).call(null);
4512
4619
  }
4513
- }
4620
+
4621
+
4622
+ }, null);
4514
4623
 
4515
4624
  if (isBrowser) {
4516
- asyncLoad(function() {
4517
- Ready(function() {
4518
- window.onpopstate = function(event) {
4625
+ asyncLoad(function () {
4626
+ Ready(function () {
4627
+ window.onpopstate = function (event) {
4519
4628
  event.stopImmediatePropagation();
4520
4629
  event.stopPropagation();
4521
4630
  ClassFactory("Component").route();
@@ -4527,79 +4636,91 @@
4527
4636
  * possible events: scrollpercent, defaultscroll, percentY0, percentY25, percentY50, percentY75, percentY90
4528
4637
  */
4529
4638
 
4530
- (function (_top){
4531
- let lastKnownScrollPosition = 0;
4532
- let ticking = false;
4533
- let scrollHeight = Math.max(
4534
- document.body.scrollHeight, document.documentElement.scrollHeight,
4535
- document.body.offsetHeight, document.documentElement.offsetHeight,
4536
- document.body.clientHeight, document.documentElement.clientHeight
4537
- );
4538
-
4539
- let scrollWidth = Math.max(
4540
- document.body.scrollWidth, document.documentElement.scrollWidth,
4541
- document.body.offsetWidth, document.documentElement.offsetWidth,
4542
- document.body.clientWidth, document.documentElement.clientWidth
4543
- );
4544
-
4545
- function scrollDispatcher(event) {
4546
- var percentY = Math.round(_top.scrollY * 100 / scrollHeight);
4547
- var percentX = Math.round(_top.scrollX * 100 / scrollWidth);
4548
- var scrollPercentEventEvent = new CustomEvent("scrollpercent", {
4549
- detail: {
4550
- percentX: percentX,
4551
- percentY: percentY
4552
- }
4553
- });
4554
- event.target.dispatchEvent(scrollPercentEventEvent);
4555
- var secondaryEventName = "defaultscroll";
4556
- var __valid_scrolls__ = [0, 5, 10, 25, 50, 75, 90, 95, 100];
4557
- __valid_scrolls__.filter(function (p) { return p===percentY;}).map (function (pY){
4558
- secondaryEventName = "percentY"+percentY.toString();
4559
- var secondaryCustomEvent = new CustomEvent(secondaryEventName, {
4560
- detail: {
4561
- percentX: percentX,
4562
- percentY: percentY
4563
- }
4564
- });
4565
- event.target.dispatchEvent(secondaryCustomEvent);
4566
- });
4567
-
4568
- }
4569
-
4570
- document.addEventListener("scroll", function(event) {
4571
-
4572
- if (!ticking) {
4573
- requestAnimationFrame(function() {
4574
- scrollDispatcher(event);
4575
- ticking = false;
4576
- });
4577
-
4578
- ticking = true;
4579
- }
4580
- });
4581
-
4582
- })(_top);
4639
+ (function (_top) {
4640
+ let lastKnownScrollPosition = 0;
4641
+ let ticking = false;
4642
+ let scrollHeight = Math.max(
4643
+ document.body.scrollHeight, document.documentElement.scrollHeight,
4644
+ document.body.offsetHeight, document.documentElement.offsetHeight,
4645
+ document.body.clientHeight, document.documentElement.clientHeight
4646
+ );
4647
+
4648
+ let scrollWidth = Math.max(
4649
+ document.body.scrollWidth, document.documentElement.scrollWidth,
4650
+ document.body.offsetWidth, document.documentElement.offsetWidth,
4651
+ document.body.clientWidth, document.documentElement.clientWidth
4652
+ );
4653
+
4654
+ function scrollDispatcher(event) {
4655
+ var percentY = Math.round(_top.scrollY * 100 / scrollHeight);
4656
+ var percentX = Math.round(_top.scrollX * 100 / scrollWidth);
4657
+ var scrollPercentEventEvent = new CustomEvent("scrollpercent", {
4658
+ detail: {
4659
+ percentX: percentX,
4660
+ percentY: percentY
4661
+ }
4662
+ });
4663
+ event.target.dispatchEvent(scrollPercentEventEvent);
4664
+ var secondaryEventName = "defaultscroll";
4665
+ var __valid_scrolls__ = [0, 5, 10, 25, 50, 75, 90, 95, 100];
4666
+ __valid_scrolls__.filter(function (p) {
4667
+ return p === percentY;
4668
+ }).map(function (pY) {
4669
+ secondaryEventName = "percentY" + percentY.toString();
4670
+ var secondaryCustomEvent = new CustomEvent(secondaryEventName, {
4671
+ detail: {
4672
+ percentX: percentX,
4673
+ percentY: percentY
4674
+ }
4675
+ });
4676
+ event.target.dispatchEvent(secondaryCustomEvent);
4677
+ });
4678
+
4679
+ }
4680
+
4681
+ document.addEventListener("scroll", function (event) {
4682
+
4683
+ if (!ticking) {
4684
+ requestAnimationFrame(function () {
4685
+ scrollDispatcher(event);
4686
+ ticking = false;
4687
+ });
4688
+
4689
+ ticking = true;
4690
+ }
4691
+ });
4692
+
4693
+ })(_top);
4583
4694
 
4584
4695
  });
4585
4696
  }, null);
4586
4697
  }
4587
4698
 
4699
+ if (!isBrowser) {
4700
+ if (typeof _top.global !== "undefined" && Object.hasOwnProperty.call(_top.global, "_fireAsyncLoad")) {
4701
+ _top.global._fireAsyncLoad.call(this);
4702
+ }
4703
+ if (typeof _top.global !== "undefined" && Object.hasOwnProperty.call(_top.global, "onload")) {
4704
+ _top.global.onload.call(this);
4705
+ }
4706
+ }
4707
+
4708
+
4588
4709
  /* Freezing Object && Object.prototype to prevent prototype pollution risks */
4589
- (function (isBrowser){
4590
- var __freeze__ = function (){
4591
- Object.freeze(Object.prototype);
4592
- Object.freeze(Object);
4593
- };
4594
- if (isBrowser && _top.CONFIG.get("secureObjects", false)){
4595
- Ready(function (){
4596
- __freeze__();
4597
- });
4598
- } else if (_top.CONFIG.get("secureObjects", false)) {
4710
+ (function (isBrowser) {
4711
+ var __freeze__ = function () {
4712
+ Object.freeze(Object.prototype);
4713
+ Object.freeze(Object);
4714
+ };
4715
+ if (isBrowser && _top.CONFIG.get("secureObjects", false)) {
4716
+ Ready(function () {
4599
4717
  __freeze__();
4600
- }
4718
+ });
4719
+ } else if (_top.CONFIG.get("secureObjects", false)) {
4720
+ __freeze__();
4721
+ }
4601
4722
  })(isBrowser);
4602
4723
 
4603
- }).call(null,(typeof module === "object" && typeof module.exports === "object")?(module.exports = global):((typeof global === "object")?(global):(
4604
- (typeof window === "object")?(window):({})
4605
- )));
4724
+ }).call(null, (typeof module === "object" && typeof module.exports === "object") ? (module.exports = global) : ((typeof global === "object") ? (global) : (
4725
+ (typeof window === "object") ? (window) : ({})
4726
+ )));