cronapi-js 2.8.19 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cronapi.js CHANGED
@@ -16,7 +16,7 @@ if (!window.fixedTimeZone) {
16
16
  window.timeZoneOffset = moment().utcOffset();
17
17
  }
18
18
 
19
- (function() {
19
+ function cronapi() {
20
20
  'use strict';
21
21
 
22
22
  this.$evt = function(str) {
@@ -57,13 +57,53 @@ if (!window.fixedTimeZone) {
57
57
  return arg;
58
58
  }
59
59
 
60
+ var reorderArgs = function(argsValues, argsMetadata, argsNames) {
61
+ if (argsMetadata && argsMetadata.length && argsNames && argsNames.length) {
62
+ let args = [];
63
+ for (var i = 0;i <argsMetadata.length;i++) {
64
+ args.push(null);
65
+ }
66
+ for (let i = 0; i<argsMetadata.length; i++) {
67
+ for (let j = 0; j<argsNames.length; j++) {
68
+ if (typeof argsMetadata[i] === 'string') {
69
+ if (argsMetadata[i] == argsNames[j]) {
70
+ args[i] = argsValues[j];
71
+ break;
72
+ }
73
+ } else {
74
+ if (argsMetadata[i].description == argsNames[j] || argsMetadata[i].id == argsNames[j] ) {
75
+ args[i] = argsValues[j];
76
+ break;
77
+ }
78
+ }
79
+
80
+ }
81
+ }
82
+
83
+ return args;
84
+ }
85
+
86
+ return argsValues;
87
+ }
88
+
60
89
  this.cronapi.evalInContext = async function(js) {
61
90
  var result = eval('this.cronapi.doEval('+js+')');
62
91
  if (result) {
63
92
  if (result.commands) {
64
93
  for (var i = 0; i < result.commands.length; i++) {
65
94
  var func = eval(result.commands[i].function);
66
- await func.apply(this, result.commands[i].params);
95
+ let argsMetadata;
96
+ let argsNames = result.commands[i].names;
97
+ let args = result.commands[i].params;
98
+ try {
99
+ argsMetadata = eval(result.commands[i].function+'Args');
100
+ } catch(e) {
101
+ //
102
+ }
103
+
104
+ args = reorderArgs(args, argsMetadata, argsNames);
105
+
106
+ await func.apply(this, args);
67
107
  }
68
108
  }
69
109
  return result.value;
@@ -108,24 +148,19 @@ if (!window.fixedTimeZone) {
108
148
  //
109
149
  }
110
150
 
151
+ if (!argsMetadata) {
152
+ try {
153
+ argsMetadata = eval(pack+'Args');
154
+ } catch(e) {
155
+ //
156
+ }
157
+ }
158
+
111
159
  if (!bk) {
112
160
  bk = eval(pack);
113
161
  }
114
162
 
115
- if (argsMetadata && argsMetadata.length && argsNames && argsNames.length) {
116
- args = [];
117
- for (var i = 0;i <argsMetadata.length;i++) {
118
- args.push(null);
119
- }
120
- for (let i = 0; i<argsMetadata.length; i++) {
121
- for (let j = 0; j<argsNames.length; j++) {
122
- if (argsMetadata[i] == argsNames[j]) {
123
- args[i] = arguments[j];
124
- break;
125
- }
126
- }
127
- }
128
- }
163
+ args = reorderArgs(args, argsMetadata, argsNames);
129
164
 
130
165
  if (attr) {
131
166
  let result = bk.apply(this, args);
@@ -583,7 +618,7 @@ if (!window.fixedTimeZone) {
583
618
  var params = [];
584
619
  var names;
585
620
  $(arguments).each(function() {
586
- if (this && typeof this === 'object' && this.argsNames && this.argsNames.constructor === Array) {
621
+ if (this && Array.isArray(this.argsNames)) {
587
622
  names = this.argsNames;
588
623
  } else {
589
624
  params.push(this);
@@ -918,6 +953,31 @@ if (!window.fixedTimeZone) {
918
953
  this.cronapi.$scope.getReport(name);
919
954
  };
920
955
 
956
+ /**
957
+ * @type function
958
+ * @name obter IP
959
+ * @nameTags getIP|Obter IP
960
+ * @description Obtém o IP público da conexão
961
+ * @returns {ObjectType.STRING}
962
+ */
963
+ this.cronapi.util.getIP = function() {
964
+ return $.get({url: "https://api.ipify.org/", async: false}).responseText;
965
+ };
966
+
967
+ /**
968
+ * @type function
969
+ * @name {{openDashboard}}
970
+ * @nameTags openDashboard|abrirdashboard
971
+ * @description {{openDashboardDescription}}
972
+ * @param {ObjectType.STRING} value {{dashboard}}
973
+ * @multilayer true
974
+ * @returns {ObjectType.VOID}
975
+ * @wizard procedures_opendashboard_callnoreturn
976
+ */
977
+ this.cronapi.util.openDashboard = function(/** @type {ObjectType.STRING} @blockType util_dashboard_list */ name) {
978
+ this.cronapi.$scope.getDashboard(name);
979
+ };
980
+
921
981
  /**
922
982
  * @type internal
923
983
  */
@@ -948,7 +1008,7 @@ if (!window.fixedTimeZone) {
948
1008
  * @param {ObjectType.STRING} error {{error}}
949
1009
  */
950
1010
  this.cronapi.util.getURLFromOthers = function(/** @type {ObjectType.STRING} @description {{HTTPMethod}} @blockType util_dropdown @keys GET|POST|PUT|DELETE|PATCH|HEAD|OPTIONS|TRACE @values GET|POST|PUT|DELETE|PATCH|HEAD|OPTIONS|TRACE */ method , /** @type {ObjectType.STRING} @description {{HTTPMethod}} @blockType util_dropdown @keys application/x-www-form-urlencoded|application/json @values application/x-www-form-urlencoded|application/json */ contentType , /** @type {ObjectType.STRING} @description {{URLAddress}} */ url, /** @type {ObjectType.OBJECT} @description {{paramsHTTP}} */ params, /** @type {ObjectType.OBJECT} @description {{headers}} */ headers, /** @type {ObjectType.STATEMENTSENDER} @description {{success}} */ success, /** @type {ObjectType.STATEMENTSENDER} @description {{error}} */ error ) {
951
-
1011
+
952
1012
  if (params && contentType === "application/x-www-form-urlencoded") {
953
1013
  for (var key in params) {
954
1014
  if (params[key] instanceof Array) {
@@ -960,7 +1020,7 @@ if (!window.fixedTimeZone) {
960
1020
  else if (params && contentType === "application/json") {
961
1021
  params = JSON.stringify(params);
962
1022
  }
963
-
1023
+
964
1024
  var header = Object.create(headers);
965
1025
  header["Content-Type"] = contentType;
966
1026
  // Angular has a .run that inject X-AUTH-TOKEN, so we use JQuery
@@ -1258,7 +1318,6 @@ if (!window.fixedTimeZone) {
1258
1318
  this.cronapi.screen.getScopeVariable = function(name) {
1259
1319
  return this.cronapi.$scope.vars[name];
1260
1320
  };
1261
-
1262
1321
  /**
1263
1322
  * @deprecated true
1264
1323
  * @type function
@@ -1278,6 +1337,7 @@ if (!window.fixedTimeZone) {
1278
1337
  this.cronapi.$scope.Notification({'message':message.toString() },type);
1279
1338
  };
1280
1339
 
1340
+
1281
1341
  /**
1282
1342
  * @type function
1283
1343
  * @name {{datasourceFromScreenName}}
@@ -1481,6 +1541,7 @@ if (!window.fixedTimeZone) {
1481
1541
  };
1482
1542
 
1483
1543
  /**
1544
+ * @deprecated true
1484
1545
  * @type function
1485
1546
  * @name {{datasourceFilterName}}
1486
1547
  * @nameTags filter|datasource
@@ -1498,6 +1559,51 @@ if (!window.fixedTimeZone) {
1498
1559
  }
1499
1560
  };
1500
1561
 
1562
+ /**
1563
+ * @type function
1564
+ * @name {{datasourceFilterName1}}
1565
+ * @nameTags filter|datasource
1566
+ * @description {{datasourceFilterDescription}}
1567
+ * @param {ObjectType.STRING} datasource {{datasourceFilterParam0}}
1568
+ * @param {ObjectType.STRING} condition {{datasourceFilterParam6}}
1569
+ * @param {ObjectType.LIST} filter {{datasourceFilterParam5}}
1570
+ * @multilayer true
1571
+ */
1572
+ this.cronapi.screen.doFilter = function(/** @type {ObjectType.OBJECT} @blockType datasource_from_screen*/ datasource, /** @type {ObjectType.String} @description {{datasourceFilterParam6}} @blockType util_dropdown @keys or|and @values {{datasourceFilterConditionOr}}|{{datasourceFilterConditionAnd}} */ condition,/** @type {ObjectType.LIST}*/ filter) {
1573
+
1574
+ let path = filter;
1575
+
1576
+ if(filter instanceof Array){
1577
+ path = filter.join(' ' + condition + ' ');
1578
+ }
1579
+
1580
+ if(getDatasource(datasource).isOData()){
1581
+ getDatasource(datasource).search(path);
1582
+ }
1583
+ else{
1584
+ getDatasource(datasource).filter('/' + path);
1585
+ }
1586
+ };
1587
+
1588
+ /**
1589
+ * @type function
1590
+ * @name {{datasourceFilterName2}}
1591
+ * @nameTags filter|datasource
1592
+ * @description {{datasourceFilterDescription}}
1593
+ * @param {ObjectType.STRING} field {{datasourceFilterParam2}}
1594
+ * @param {ObjectType.STRING} filterType {{datasourceFilterParam3}}
1595
+ * @param {ObjectType.STRING} filterValue {{datasourceFilterParam4}}
1596
+ * @returns {ObjectType.LIST}
1597
+ * @multilayer true
1598
+ */
1599
+ this.cronapi.screen.createFilter = function(/** @type {ObjectType.String} */ field, /** @type {ObjectType.String} @description {{datasourceFilterParam3}} @blockType util_dropdown @keys eq|ne|gt|lt|ge|le|substringof @values {{datasourceFilterOprEq}}|datasourceFilterOprNe|datasourceFilterOprGt|datasourceFilterOprLt|datasourceFilterOprGe|datasourceFilterOprLe|datasourceFilterOprSubStr */ filterType, /** @type {ObjectType.Object}*/ filterValue) {
1600
+ if(filterType === "substringof"){
1601
+ return "substringof('" + filterValue + "', tolower(" + field + "))";
1602
+ }
1603
+
1604
+ return field + " " + filterType + " " + objToOData(filterValue) + "";
1605
+ };
1606
+
1501
1607
  /**
1502
1608
  * @type function
1503
1609
  * @name {{changeView}}
@@ -1569,7 +1675,7 @@ if (!window.fixedTimeZone) {
1569
1675
 
1570
1676
  var oldHashToCheck = oldHash + (oldHash.indexOf("?") > -1 ? "": "?");
1571
1677
  var viewToCheck = view + (view.indexOf("?") > -1 ? "": "?");
1572
-
1678
+
1573
1679
  this.cronapi.forceCloseAllModal();
1574
1680
 
1575
1681
  if(oldHashToCheck.indexOf(viewToCheck) >= 0){
@@ -1640,6 +1746,7 @@ if (!window.fixedTimeZone) {
1640
1746
  return null;
1641
1747
  };
1642
1748
 
1749
+
1643
1750
  /**
1644
1751
  * @deprecated true
1645
1752
  * @type function
@@ -1654,7 +1761,8 @@ if (!window.fixedTimeZone) {
1654
1761
  var value = confirm(msg);
1655
1762
  return value;
1656
1763
  };
1657
-
1764
+
1765
+
1658
1766
  /**
1659
1767
  * @type function
1660
1768
  * @name {{createDefaultModalName}}
@@ -2592,7 +2700,24 @@ if (!window.fixedTimeZone) {
2592
2700
  return null;
2593
2701
  }
2594
2702
 
2595
- /**
2703
+ /**
2704
+ * @type function
2705
+ * @name {{toSupplyText}}
2706
+ * @description {{toSupplyTextDescription}}
2707
+ * @nameTags text|replace|supply
2708
+ * @param {ObjectType.STRING} text {{toSupplyTextParam0}}
2709
+ * @param {ObjectType.OBJECT} terms {{toSupplyTextParam1}}
2710
+ * @arbitraryParams true
2711
+ * @returns {ObjectType.STRING}
2712
+ */
2713
+ this.cronapi.text.formatTextWithReplacement = function(text, ...terms) {
2714
+ var args = Array.prototype.slice.call(terms, 0);
2715
+ return text.replace(/\{(\d+)\}/g, function (match, index) {
2716
+ return args[index];
2717
+ });
2718
+ };
2719
+
2720
+ /**
2596
2721
  * @type function
2597
2722
  * @name {{newline}}
2598
2723
  * @description {{newlineDescription}}
@@ -3016,6 +3141,12 @@ if (!window.fixedTimeZone) {
3016
3141
 
3017
3142
  this.cronapi.internal = {};
3018
3143
 
3144
+ this.cronapi.internal.skipIterationLoop = function() {
3145
+ return new Promise((resolve) => {
3146
+ resolve();
3147
+ });
3148
+ };
3149
+
3019
3150
  this.cronapi.internal.coverElement = function($element) {
3020
3151
 
3021
3152
  let cover = (id, obj) => {
@@ -3049,13 +3180,15 @@ if (!window.fixedTimeZone) {
3049
3180
  if ($firstInput && $firstInput.length) {
3050
3181
  let waitBecomeVisible = setInterval(()=> {
3051
3182
  if ($firstInput.is(':visible')) {
3052
- $firstInput.focus();
3183
+ if ($firstInput.data('role') !== 'dropdownlist') {
3184
+ $firstInput.focus();
3185
+ }
3053
3186
  clearInterval(waitBecomeVisible);
3054
3187
  }
3055
3188
  }, 100);
3056
3189
  }
3057
3190
  };
3058
-
3191
+
3059
3192
  this.cronapi.forceCloseAllModal = function() {
3060
3193
  var modals = $('.modal.fade.in');
3061
3194
  if (modals) {
@@ -3393,7 +3526,7 @@ if (!window.fixedTimeZone) {
3393
3526
  }
3394
3527
 
3395
3528
  this.cronapi.internal.downloadFileEntityMobile = function(datasource, field, indexData, fileInfo) {
3396
-
3529
+
3397
3530
  var tempJsonFileUploaded = null;
3398
3531
  var valueContent;
3399
3532
  var itemActive;
@@ -3416,7 +3549,7 @@ if (!window.fixedTimeZone) {
3416
3549
  var tempJsonFileUploaded = JSON.parse(valueContent);
3417
3550
  }
3418
3551
  catch(e) { }
3419
-
3552
+
3420
3553
  if (tempJsonFileUploaded) {
3421
3554
  var finalUrl = this.cronapi.internal.getAddressWithHostApp('/api/cronapi/filePreview/');
3422
3555
  window.open(finalUrl + tempJsonFileUploaded.path, '_system');
@@ -3431,7 +3564,7 @@ if (!window.fixedTimeZone) {
3431
3564
  else {
3432
3565
  var url = '/api/cronapi/downloadFile';
3433
3566
  var splited = datasource.entity.split('/');
3434
-
3567
+
3435
3568
  var entity = splited[splited.length - 1];
3436
3569
  if (entity.indexOf(":") > -1) {
3437
3570
  //Siginifica que é relacionamento, pega a entidade do relacionamento
@@ -3476,20 +3609,21 @@ if (!window.fixedTimeZone) {
3476
3609
  let barCodeOneD = "UPC_A|UPC_E|EAN_8|EAN_13|CODE_39|CODE_128|ITF|RSS14|RSS_EXPANDED";
3477
3610
  let codeReader;
3478
3611
 
3612
+
3479
3613
  navigator.mediaDevices.getUserMedia({audio: false, video: true}).then(stream => {
3480
3614
 
3481
3615
  switch (scanOptions.formats) {
3482
3616
  case "AZTEC":
3483
- codeReader = new ZXing.BrowserAztecCodeReader();
3617
+ codeReader = new ZXing.BrowserAztecCodeReader();
3484
3618
  break;
3485
3619
  case "DATA_MATRIX":
3486
- codeReader = new ZXing.BrowserDatamatrixCodeReader();
3487
- break;
3620
+ codeReader = new ZXing.BrowserDatamatrixCodeReader();
3621
+ break;
3488
3622
  case "QR_CODE":
3489
- codeReader = new ZXing.BrowserQRCodeReader();
3623
+ codeReader = new ZXing.BrowserQRCodeReader();
3490
3624
  break;
3491
3625
  case "PDF_417":
3492
- codeReader = new ZXing.BrowserPDF417Reader();
3626
+ codeReader = new ZXing.BrowserPDF417Reader();
3493
3627
  break;
3494
3628
  default:
3495
3629
  codeReader = new ZXing.BrowserMultiFormatReader();
@@ -3499,68 +3633,68 @@ if (!window.fixedTimeZone) {
3499
3633
  codeReader = new ZXing.BrowserBarcodeReader();
3500
3634
  }
3501
3635
 
3502
- codeReader.listVideoInputDevices()
3636
+ codeReader.listVideoInputDevices()
3503
3637
  .then((videoInputDevices) => {
3504
3638
  selectedDeviceId = videoInputDevices[0].deviceId
3505
3639
  let cameraContainer = `<div style="position: fixed; display: flex; width: 100%; height: 100%; top: 0; left: 0; right: 0; bottom: 0; background-color:
3506
- rgb(0 0 0 / 72%); z-index: 9999999; cursor: pointer; justify-content: center; align-items: center;">
3507
- <div style="position: absolute">
3508
- <div class="row" style="position: absolute; bottom 50px; z-index: 999999999;">
3509
- <div class="col-xs-8">
3510
- <select style="width: 100%; position: absolute; bottom: 10px; left: 0; z-index: 999999999;" id="videoSource"></select>
3511
- </div>
3512
- <div class="col-xs-2">
3513
- <button class="btn btn-danger button button-dark" id="cronapiBarCodeChangeCam" >
3514
- <span class="glyphicon glyphicon-remove icon ion ion-ios-reverse-camera"></span>
3515
- <span class="sr-only">{{"ChangeCam" | translate}}</span>
3516
- </button>
3517
- </div>
3518
- <div class="col-xs-2">
3519
- <button class="btn btn-danger button button-assertive" id="cronapiBarCodeCancel" >
3520
- <span class="glyphicon glyphicon-remove icon ion-android-close"></span>
3521
- <span class="sr-only">{{"Cancel" | translate}}</span>
3522
- </button>
3523
- </div>
3524
- </div>
3525
- <video id="video" style="width: 100%; max-width: 600px; border-radius: 5px;"></video>
3526
- </div>
3527
- </div>`;
3640
+ rgb(0 0 0 / 72%); z-index: 9999999; cursor: pointer; justify-content: center; align-items: center;">
3641
+ <div style="position: absolute">
3642
+ <div class="row" style="position: absolute; bottom 50px; z-index: 999999999;">
3643
+ <div class="col-xs-8">
3644
+ <select style="width: 100%; position: absolute; bottom: 10px; left: 0; z-index: 999999999;" id="videoSource"></select>
3645
+ </div>
3646
+ <div class="col-xs-2">
3647
+ <button class="btn btn-danger button button-dark" id="cronapiBarCodeChangeCam" >
3648
+ <span class="glyphicon glyphicon-remove icon ion ion-ios-reverse-camera"></span>
3649
+ <span class="sr-only">{{"ChangeCam" | translate}}</span>
3650
+ </button>
3651
+ </div>
3652
+ <div class="col-xs-2">
3653
+ <button class="btn btn-danger button button-assertive" id="cronapiBarCodeCancel" >
3654
+ <span class="glyphicon glyphicon-remove icon ion-android-close"></span>
3655
+ <span class="sr-only">{{"Cancel" | translate}}</span>
3656
+ </button>
3657
+ </div>
3658
+ </div>
3659
+ <video id="video" style="width: 100%; max-width: 600px; border-radius: 5px;"></video>
3660
+ </div>
3661
+ </div>`;
3528
3662
  let cronappVideoBarCode = $(cameraContainer);
3529
3663
  cronappVideoBarCode.prependTo("body");
3530
- videoInputDevices.map((device, index)=>{
3531
- if (device.kind === 'videoinput') {
3532
- let option = document.createElement('option');
3533
- option.value = device.deviceId;
3534
- option.text = device.label || 'Câmera ' + (index + 1);
3535
- if (index === 0) {
3536
- option.selected = true;
3537
- }
3538
- document.querySelector('select#videoSource').appendChild(option);
3539
- }
3540
- });
3664
+ videoInputDevices.map((device, index)=>{
3665
+ if (device.kind === 'videoinput') {
3666
+ let option = document.createElement('option');
3667
+ option.value = device.deviceId;
3668
+ option.text = device.label || 'Câmera ' + (index + 1);
3669
+ if (index === 0) {
3670
+ option.selected = true;
3671
+ }
3672
+ document.querySelector('select#videoSource').appendChild(option);
3673
+ }
3674
+ });
3541
3675
  cronappVideoBarCode.find('#cronapiBarCodeCancel').on('click', (() => {
3542
- codeReader.reset();
3543
3676
  $(cronappVideoBarCode).remove();
3677
+ codeReader.reset();
3544
3678
  }).bind(this));
3545
3679
  cronappVideoBarCode.find('#cronapiBarCodeChangeCam').on('click', (() => {
3546
- let selectedIndex = $("#videoSource").prop("selectedIndex");
3547
- let itemsInDropDownList = $("#videoSource option").length;
3548
-
3549
- if (selectedIndex < (itemsInDropDownList - 1)) {
3550
- $("#videoSource").prop("selectedIndex", selectedIndex + 1);
3551
- } else {
3552
- $("#videoSource").prop("selectedIndex", 0);
3553
- }
3554
- $("#videoSource").trigger('change');
3680
+ let selectedIndex = $("#videoSource").prop("selectedIndex");
3681
+ let itemsInDropDownList = $("#videoSource option").length;
3682
+
3683
+ if (selectedIndex < (itemsInDropDownList - 1)) {
3684
+ $("#videoSource").prop("selectedIndex", selectedIndex + 1);
3685
+ } else {
3686
+ $("#videoSource").prop("selectedIndex", 0);
3687
+ }
3688
+ $("#videoSource").trigger('change');
3555
3689
  }).bind(this));
3556
3690
  cronappVideoBarCode.find('#videoSource').on('change', (() => {
3557
- codeReader.decodeOnceFromVideoDevice($("#videoSource").val(), 'video').then((result) => {
3558
- if (result) {
3559
- success(result.text);
3560
- $(cronappVideoBarCode).remove();
3561
- codeReader.reset();
3562
- }
3563
- });
3691
+ codeReader.decodeOnceFromVideoDevice($("#videoSource").val(), 'video').then((result) => {
3692
+ if (result) {
3693
+ success(result.text);
3694
+ $(cronappVideoBarCode).remove();
3695
+ codeReader.reset();
3696
+ }
3697
+ });
3564
3698
  }).bind(this));
3565
3699
  codeReader.decodeOnceFromVideoDevice(selectedDeviceId, 'video').then((result) => {
3566
3700
  if (result) {
@@ -3574,9 +3708,10 @@ if (!window.fixedTimeZone) {
3574
3708
  fail(err);
3575
3709
  codeReader.reset();
3576
3710
  });
3711
+
3577
3712
  }).catch(function(err) {
3578
- fail(err);
3579
- });
3713
+ fail(err);
3714
+ });
3580
3715
  }
3581
3716
 
3582
3717
  this.cronapi.internal.castBinaryStringToByteArray = function(binary_string) {
@@ -3596,7 +3731,7 @@ if (!window.fixedTimeZone) {
3596
3731
  this.cronapi.internal.castByteArrayToString = function(bytes) {
3597
3732
  return String.fromCharCode.apply(null, new Uint16Array(bytes));
3598
3733
  };
3599
-
3734
+
3600
3735
  this.cronapi.internal.generatePreviewDescriptionByte = function(data, fileInfo) {
3601
3736
  var json;
3602
3737
  let fileInfoContent = eval(fileInfo);
@@ -3645,7 +3780,7 @@ if (!window.fixedTimeZone) {
3645
3780
  if (json) {
3646
3781
  if (json.name.length > 25)
3647
3782
  json.name = json.name.substr(0,22)+'...';
3648
-
3783
+
3649
3784
  var result = (this.cronapi.$translate.use() == 'pt_br' ? "<b>Nome:</b> <br/>" : "<b>Name:</b> <br/>") + (json.contentType !== undefined ? json.name +"<br/>" : "");
3650
3785
  result += json.contentType !== undefined ? "<b>Content-Type:</b> <br/>" + json.contentType +"<br/>" : "";
3651
3786
  result += json.fileExtension !== "" ? this.cronapi.$translate.use() == 'pt_br' ? "<b>Extensão:</b> <br/>" + json.fileExtension +"<br/>" : "<b>Extension:</b> <br/>" + json.fileExtension +"<br/>" : "";
@@ -3722,7 +3857,7 @@ if (!window.fixedTimeZone) {
3722
3857
  return false;
3723
3858
  }
3724
3859
  };
3725
-
3860
+
3726
3861
  this.cronapi.internal.downloadUrl = function(url, fileName) {
3727
3862
  let link = document.createElement('a');
3728
3863
  link.setAttribute('href', url);
@@ -3731,12 +3866,12 @@ if (!window.fixedTimeZone) {
3731
3866
  event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
3732
3867
  link.dispatchEvent(event);
3733
3868
  };
3734
-
3869
+
3735
3870
  this.cronapi.internal.makeDownloadFromBytes = function(valueContent, fileInfo) {
3736
3871
  var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL;
3737
3872
  var bytesOrFileInput;
3738
3873
  var fileName = 'download';
3739
-
3874
+
3740
3875
  if (valueContent.match(/__odataFile_/g)) {
3741
3876
  bytesOrFileInput = eval(valueContent);
3742
3877
  fileName = bytesOrFileInput.name
@@ -3758,9 +3893,9 @@ if (!window.fixedTimeZone) {
3758
3893
  var url = urlCreator.createObjectURL(new Blob([bytesOrFileInput],{type: 'application/octet-stream'}));
3759
3894
  cronapi.internal.downloadUrl(url, fileName);
3760
3895
  };
3761
-
3896
+
3762
3897
  this.cronapi.internal.downloadFileEntity = function(datasource, field, indexData, fileInfo) {
3763
-
3898
+
3764
3899
  var tempJsonFileUploaded = null;
3765
3900
  var valueContent;
3766
3901
  var itemActive;
@@ -3783,7 +3918,7 @@ if (!window.fixedTimeZone) {
3783
3918
  var tempJsonFileUploaded = JSON.parse(valueContent);
3784
3919
  }
3785
3920
  catch(e) { }
3786
-
3921
+
3787
3922
  if (tempJsonFileUploaded) {
3788
3923
  window.open('/api/cronapi/filePreview/'+tempJsonFileUploaded.path);
3789
3924
  }
@@ -3791,14 +3926,14 @@ if (!window.fixedTimeZone) {
3791
3926
  window.open(valueContent);
3792
3927
  }
3793
3928
  else {
3794
-
3929
+
3795
3930
  if (datasource.isOData()) {
3796
3931
  cronapi.internal.makeDownloadFromBytes(valueContent, fileInfo);
3797
3932
  }
3798
3933
  else {
3799
3934
  var url = '/api/cronapi/downloadFile';
3800
3935
  var splited = datasource.entity.split('/');
3801
-
3936
+
3802
3937
  var entity = splited[splited.length-1];
3803
3938
  if (entity.indexOf(":") > -1) {
3804
3939
  //Siginifica que é relacionamento, pega a entidade do relacionamento
@@ -3809,14 +3944,14 @@ if (!window.fixedTimeZone) {
3809
3944
  var entityRelationSplited = entity.split(':');
3810
3945
  entity = entityRelation + entityRelationSplited[entityRelationSplited.length-1];
3811
3946
  }
3812
-
3947
+
3813
3948
  url += '/' + entity;
3814
3949
  url += '/' + field;
3815
3950
  var _u = JSON.parse(localStorage.getItem('_u')) || {};
3816
3951
  var object = itemActive;
3817
-
3952
+
3818
3953
  var finalUrl = this.cronapi.internal.getAddressWithHostApp(url);
3819
-
3954
+
3820
3955
  this.$promise = this.cronapi.$scope.$http({
3821
3956
  method: 'POST',
3822
3957
  url: finalUrl,
@@ -3844,9 +3979,9 @@ if (!window.fixedTimeZone) {
3844
3979
  console.log('Error downloading file');
3845
3980
  }.bind(this));
3846
3981
  }
3847
-
3982
+
3848
3983
  }
3849
-
3984
+
3850
3985
  };
3851
3986
 
3852
3987
  this.cronapi.internal.uploadFileAjax = function(field, file, progressId) {
@@ -3896,14 +4031,14 @@ if (!window.fixedTimeZone) {
3896
4031
  }.bind(this));
3897
4032
 
3898
4033
  };
3899
-
4034
+
3900
4035
  this.cronapi.internal.getFieldFromActiveString = function(rawActive) {
3901
4036
  var regexForField = /.active.([a-zA-Z0-9_-]*)/g;
3902
4037
  var groupField = regexForField.exec(rawActive);
3903
4038
  var fieldName = groupField[1];
3904
4039
  return fieldName;
3905
4040
  };
3906
-
4041
+
3907
4042
  this.cronapi.internal.getJsonDescriptionFromFile = function(file) {
3908
4043
  let json = {};
3909
4044
  if (file) {
@@ -3927,7 +4062,7 @@ if (!window.fixedTimeZone) {
3927
4062
 
3928
4063
  if (!file)
3929
4064
  return;
3930
-
4065
+
3931
4066
  var regexForDatasource = /(.*?).active./g;
3932
4067
  var groupDatasource = regexForDatasource.exec(field);
3933
4068
  //Verificar se é campo de um datasource
@@ -4264,8 +4399,7 @@ if (!window.fixedTimeZone) {
4264
4399
  this.cronapi.cordova.geolocation = {};
4265
4400
 
4266
4401
  /**
4267
- * @type function
4268
- * @platform M
4402
+ * @type function
4269
4403
  * @name {{getCurrentPosition}}
4270
4404
  * @nameTags geolocation|getCurrentPosition
4271
4405
  * @param {ObjectType.STATEMENTSENDER} success {{success}}
@@ -4332,6 +4466,7 @@ if (!window.fixedTimeZone) {
4332
4466
  }
4333
4467
  !success || success(data);
4334
4468
  };
4469
+
4335
4470
  navigator.camera.getPicture(this.cronapi.util.handleCallback(resultWithData), this.cronapi.util.handleCallback(error), options);
4336
4471
  }else{
4337
4472
  options.allowEdit = allowEdit;
@@ -4525,7 +4660,7 @@ if (!window.fixedTimeZone) {
4525
4660
  */
4526
4661
  this.cronapi.cordova.file.createDirectory = function(dirParent, dirChildrenName, success, error) {
4527
4662
  window.resolveLocalFileSystemURL(dirParent, function(directoryEntry) {
4528
- parentEntry.getDirectory(dirChildrenName, { create: true }, function (childrenEntry) {
4663
+ directoryEntry.getDirectory(dirChildrenName, { create: true }, function (childrenEntry) {
4529
4664
  if (success)
4530
4665
  success(childrenEntry);
4531
4666
  }.bind(this),this.cronapi.util.handleCallback(error));
@@ -4775,7 +4910,6 @@ if (!window.fixedTimeZone) {
4775
4910
  */
4776
4911
  this.cronapi.event = {};
4777
4912
 
4778
-
4779
4913
  /**
4780
4914
  * @type function
4781
4915
  * @name {{contextMenu}}
@@ -4835,7 +4969,7 @@ if (!window.fixedTimeZone) {
4835
4969
  * @param {ObjectType.OBJECT} subItens {{kendoDatasource}}
4836
4970
  * @returns {ObjectType.OBJECT}
4837
4971
  */
4838
- this.cronapi.event.itemContextMenu = function (/** @type{ObjectType.STRING} */ text, /** @type{ObjectType.STRING} */ cssClass, /** @type {ObjectType.STATEMENT} */ action, subItens) {
4972
+ this.cronapi.event.itemContextMenu = function (/** @type{ObjectType.STRING} */ text, /** @type{ObjectType.STRING} */ cssClass, /** @type {ObjectType.STATEMENT} */ action, subItens) {
4839
4973
 
4840
4974
  let jsonItem = { text: text }
4841
4975
  if (subItens) { jsonItem.items = (Array.isArray(subItens) ? subItens : [subItens]) };
@@ -4883,7 +5017,7 @@ if (!window.fixedTimeZone) {
4883
5017
  * @param {ObjectType.STRING} attrValue {{attrValue}}
4884
5018
  * @multilayer true
4885
5019
  */
4886
- this.cronapi.screen.changeInnerTextButton = function (/** @type {ObjectType.OBJECT} @blockType ids_from_screen*/ id, /** @type {ObjectType.STRING} */ attrValue) {
5020
+ this.cronapi.event.changeInnerTextButton = function (/** @type {ObjectType.OBJECT} @blockType ids_from_screen*/ id, /** @type {ObjectType.STRING} */ attrValue) {
4887
5021
  let router = '#' + id + " button span"
4888
5022
  $(router).text(attrValue);
4889
5023
  };
@@ -4903,6 +5037,41 @@ if (!window.fixedTimeZone) {
4903
5037
  }
4904
5038
  };
4905
5039
 
5040
+ this.cronapi.cordova.util = {};
5041
+
5042
+ /**
5043
+ * @type function
5044
+ * @platform M
5045
+ * @name {{fingerPrintRead}}
5046
+ * @nameTags fingerprint | digital | leitor
5047
+ * @description {{fingerPrintReadDescription}}
5048
+ * @param {ObjectType.STATEMENTSENDER} success {{success}}
5049
+ * @param {ObjectType.STATEMENTSENDER} error {{error}}
5050
+ * @param {ObjectType.LONG} result {{fingerPrintResult}}
5051
+ */
5052
+ this.cronapi.cordova.util.fingerPrintRead = function (success, fail) {
5053
+ if(Fingerprint){
5054
+ Fingerprint.isAvailable(isAvailableSuccess, isAvailableError);
5055
+
5056
+ function isAvailableSuccess() {
5057
+ Fingerprint.show({}, successCallback, errorCallback);
5058
+ }
5059
+
5060
+ function successCallback(){
5061
+ success(0);
5062
+ }
5063
+
5064
+ function errorCallback(error){
5065
+ fail(-1);
5066
+ }
5067
+
5068
+ function isAvailableError() {
5069
+ fail(-2);
5070
+ }
5071
+ }else{
5072
+ fail(-2);
5073
+ }
5074
+ }
4906
5075
 
4907
5076
  //Private variables and functions
4908
5077
  this.cronapi.internal.ptDate = function(varray) {
@@ -5116,6 +5285,20 @@ if (!window.fixedTimeZone) {
5116
5285
  return window.location.origin;
5117
5286
  };
5118
5287
 
5288
+ /**
5289
+ * @type function
5290
+ * @name {{watchAcceleration}}
5291
+ * @nameTags watch|acceleration|gyroscope
5292
+ * @param {ObjectType.STATEMENTSENDER} success {{success}}
5293
+ * @description {{watchAccelerationDescription}}
5294
+ * @returns {ObjectType.VOID}
5295
+ */
5296
+ this.cronapi.util.watchAcceleration = function(/** @type {ObjectType.STATEMENTSENDER} @description {{success}} */ success) {
5297
+ window.addEventListener("deviceorientation", function(event){
5298
+ success({"absolute": event.absolute, "alpha": event.alpha, "beta": event.beta, "gamma": event.gamma});
5299
+ }, false);
5300
+ };
5301
+
5119
5302
  /**
5120
5303
  * @category CategoryType.CHART
5121
5304
  * @categoryTags Gráfico|Chart
@@ -5250,9 +5433,9 @@ if (!window.fixedTimeZone) {
5250
5433
  //Applying configs in Datasets
5251
5434
  $.each(json.data.datasets, function(index,value){
5252
5435
  if(json.data.datasets.length === 1 && colors.length > 1){
5253
- value.backgroundColor = colors;
5436
+ value.backgroundColor = colors;
5254
5437
  }else{
5255
- value.backgroundColor = colors[index] ? colors[index] : CSS_COLOR_NAMES[nextColor()];
5438
+ value.backgroundColor = colors[index] ? colors[index] : CSS_COLOR_NAMES[nextColor()];
5256
5439
  }
5257
5440
  value.borderColor = value.backgroundColor;
5258
5441
  });
@@ -5306,7 +5489,7 @@ if (!window.fixedTimeZone) {
5306
5489
 
5307
5490
 
5308
5491
  /**
5309
- * @category CategoryType.SOCIAL
5492
+ * @category {{CategoryType.SOCIAL}}
5310
5493
  * @categoryTags login|social|network|facebook|github|google|linkedin
5311
5494
  */
5312
5495
  this.cronapi.social = {};
@@ -5468,128 +5651,6 @@ if (!window.fixedTimeZone) {
5468
5651
  */
5469
5652
  this.cronapi.notification = {};
5470
5653
 
5471
- /**
5472
- * @type function
5473
- * @name {{confirmDialogAlertName}}
5474
- * @nameTags confirmDialog | Confirmar | alert | modal | alerta
5475
- * @description {{confirmDialogAlertDescription}}
5476
- * @param {ObjectType.STRING} icon {{icon}
5477
- * @param {ObjectType.STRING} title {{title}}
5478
- * @param {ObjectType.STRING} subtitle {{subtitle}}
5479
- * @param {ObjectType.OBJECT} buttonConfirmDialogAlert {{confimDialogAlert.listButton}}
5480
- * @platform W
5481
- * @multilayer true
5482
- */
5483
- this.cronapi.notification.confirmDialogAlert = function(/** @type {ObjectType.STRING} @description {{icon}} @blockType util_dropdown @keys error|success|warning|info @values {{error}}|{{success}}|{{warning}}|{{info}} */ icon, title, subtitle, /** @type {ObjectType.OBJECT} */ buttonConfirmDialogAlert) {
5484
-
5485
- let idDialog = 'cronapp-dialog-' + Math.random();
5486
- let dialog = $(`<span id="${idDialog}"></span>`);
5487
- $('body').append(dialog);
5488
-
5489
- let dataDialog = {
5490
- width: "450px",
5491
- title: false,
5492
- closable: false,
5493
- modal: true,
5494
- content: "",
5495
- animation: {
5496
- open: {
5497
- effects: "zoom:in"
5498
- },
5499
- close: {
5500
- effects: "zoom:out"
5501
- }
5502
- },
5503
- buttonLayout: "normal",
5504
- actions: [],
5505
- close: function(e) {
5506
- setInterval(() => {
5507
- $(`#${idDialog}`).data("kendoDialog").destroy();
5508
- }, 3000);
5509
- }
5510
- };
5511
-
5512
- setIcon(icon, title, subtitle);
5513
- setButton(buttonConfirmDialogAlert);
5514
-
5515
- dialog.kendoDialog(dataDialog);
5516
- dialog.data("kendoDialog").open();
5517
-
5518
- async function setIcon(icon, title, subtitle){
5519
- switch (icon){
5520
- case "error":
5521
- icon = '<div class="cronapp-icon cronapp-error" style="display: flex;"> <span class="cronapp-x-mark"><span class="cronapp-x-mark-line-left"></span><span class="cronapp-x-mark-line-right"></span></span></div>';
5522
- break;
5523
-
5524
- case "success":
5525
- icon = '<div class="cronapp-icon cronapp-success"><div class="cronapp-success-circular-line-left"></div><span class="cronapp-success-line-tip"></span> <span class="cronapp-success-line-long"></span><div class="cronapp-success-ring"></div><div class="cronapp-success-fix"></div> <div class="cronapp-success-circular-line-right"></div></div>';
5526
- break;
5527
-
5528
- case "warning":
5529
- icon = '<div class="cronapp-icon cronapp-warning"><div class="cronapp-icon-content">!</div></div>';
5530
- break;
5531
-
5532
- case "info":
5533
- icon = '<div class="cronapp-icon cronapp-info"><div class="cronapp-icon-content">i</div></div>';
5534
- break;
5535
- }
5536
- await setContent(icon, title, subtitle);
5537
- }
5538
-
5539
- function setContent(icon, title, subtitle){
5540
- dataDialog.content = '<div id="modalBodyConfirmDialog"> <div class="icon">'+ icon +'</div> <h2 class="title">'+ title +'</h2> <h3 class="subtitle">'+ subtitle +'</h3> </div>';
5541
- }
5542
-
5543
- function setButton(buttonConfirmDialogAlert){
5544
- let buttons = (Array.isArray(buttonConfirmDialogAlert) ? buttonConfirmDialogAlert : [buttonConfirmDialogAlert]);
5545
-
5546
- let hasButton = false;
5547
-
5548
- for (let i = 0; i < buttons.length; i++) {
5549
- let button = buttons[i];
5550
- if(button){
5551
- dataDialog.actions.push({
5552
- text: button.title,
5553
- action: button.value,
5554
- primary: button.primaryValue == 'true' ? true : null
5555
- });
5556
-
5557
- hasButton = true;
5558
-
5559
- }
5560
- };
5561
-
5562
- // If you have not added a button to the modal. Add to be able to close the modal.
5563
- if(!hasButton){
5564
- dataDialog.actions.push({
5565
- text: "OK",
5566
- primary: true
5567
- });
5568
- };
5569
-
5570
- }
5571
-
5572
- };
5573
-
5574
- /**
5575
- * @type function
5576
- * @name {{buttonConfirmDialogAlert}}
5577
- * @nameTags confirmDialog | botão | button | alert | modal | alerta
5578
- * @description {{buttonConfirmDialogAlertDescription}}
5579
- * @platform W
5580
- * @param {ObjectType.BOOLEAN} primaryButton {{buttonConfirmDialogAlert.primaryButton}}
5581
- * @param {ObjectType.STRING} title {{title}}
5582
- * @param {ObjectType.STRING} value {{buttonConfirmDialogAlert.value}}
5583
- * @returns {ObjectType.OBJECT}
5584
- */
5585
- this.cronapi.notification.buttonConfirmDialogAlert = function (/** @type {ObjectType.STRING} @description {{buttonConfirmDialogAlert.primaryButton}} @blockType util_dropdown @keys true|false @values {{yes}}|{{no}} */ primaryButton, title, /** @type {ObjectType.STATEMENT} @description {{buttonConfirmDialogAlert.value}} */ value) {
5586
- return {
5587
- title: title,
5588
- value: value,
5589
- primaryValue: primaryButton
5590
- };
5591
- };
5592
-
5593
5654
  /**
5594
5655
  * @type function
5595
5656
  * @name {{screenNotifySimpleName}}
@@ -5780,10 +5841,131 @@ if (!window.fixedTimeZone) {
5780
5841
  };
5781
5842
 
5782
5843
  /**
5783
- * @category CategoryType.REGEX
5784
- * @categoryTags REGEX|regex
5844
+ * @type function
5845
+ * @name {{confirmDialogAlertName}}
5846
+ * @nameTags confirmDialog | Confirmar | alert | modal | alerta
5847
+ * @description {{confirmDialogAlertDescription}}
5848
+ * @param {ObjectType.STRING} icon {{icon}
5849
+ * @param {ObjectType.STRING} title {{title}}
5850
+ * @param {ObjectType.STRING} subtitle {{subtitle}}
5851
+ * @param {ObjectType.OBJECT} buttonConfirmDialogAlert {{confimDialogAlert.listButton}}
5852
+ * @platform W
5853
+ * @multilayer true
5854
+ */
5855
+ this.cronapi.notification.confirmDialogAlert = function(/** @type {ObjectType.STRING} @description {{icon}} @blockType util_dropdown @keys error|success|warning|info @values {{error}}|{{success}}|{{warning}}|{{info}} */ icon, title, subtitle, /** @type {ObjectType.OBJECT} */ buttonConfirmDialogAlert) {
5856
+
5857
+ let idDialog = 'cronapp-dialog-' + Math.random();
5858
+ let dialog = $(`<div id="${idDialog}"></div>`);
5859
+ $('body').append(dialog);
5860
+
5861
+ let dataDialog = {
5862
+ width: "450px",
5863
+ title: false,
5864
+ closable: false,
5865
+ modal: true,
5866
+ content: "",
5867
+ animation: {
5868
+ open: {
5869
+ effects: "zoom:in"
5870
+ },
5871
+ close: {
5872
+ effects: "zoom:out"
5873
+ }
5874
+ },
5875
+ buttonLayout: "normal",
5876
+ actions: [],
5877
+ close: function(e) {
5878
+ setInterval(() => {
5879
+ $(`#${idDialog}`).data("kendoDialog").destroy();
5880
+ }, 3000);
5881
+ }
5882
+ };
5883
+
5884
+ setIcon(icon, title, subtitle);
5885
+ setButton(buttonConfirmDialogAlert);
5886
+ dialog.kendoDialog(dataDialog);
5887
+ dialog.data("kendoDialog").open();
5888
+
5889
+ async function setIcon(icon, title, subtitle){
5890
+ switch (icon){
5891
+ case "error":
5892
+ icon = '<div class="cronapp-icon cronapp-error" style="display: flex;"> <span class="cronapp-x-mark"><span class="cronapp-x-mark-line-left"></span><span class="cronapp-x-mark-line-right"></span></span></div>';
5893
+ break;
5894
+
5895
+ case "success":
5896
+ icon = '<div class="cronapp-icon cronapp-success"><div class="cronapp-success-circular-line-left"></div><span class="cronapp-success-line-tip"></span> <span class="cronapp-success-line-long"></span><div class="cronapp-success-ring"></div><div class="cronapp-success-fix"></div> <div class="cronapp-success-circular-line-right"></div></div>';
5897
+ break;
5898
+
5899
+ case "warning":
5900
+ icon = '<div class="cronapp-icon cronapp-warning"><div class="cronapp-icon-content">!</div></div>';
5901
+ break;
5902
+
5903
+ case "info":
5904
+ icon = '<div class="cronapp-icon cronapp-info"><div class="cronapp-icon-content">i</div></div>';
5905
+ break;
5906
+ }
5907
+ await setContent(icon, title, subtitle);
5908
+
5909
+ }
5910
+
5911
+ function setContent(icon, title, subtitle){
5912
+ dataDialog.content = '<div id="modalBodyConfirmDialog"> <div class="icon">'+ icon +'</div> <h2 class="title">'+ title +'</h2> <h3 class="subtitle">'+ subtitle +'</h3> </div>';
5913
+ }
5914
+
5915
+ function setButton(buttonConfirmDialogAlert){
5916
+ let buttons = (Array.isArray(buttonConfirmDialogAlert) ? buttonConfirmDialogAlert : [buttonConfirmDialogAlert]);
5917
+
5918
+ let hasButton = false;
5919
+
5920
+ for (let i = 0; i < buttons.length; i++) {
5921
+ let button = buttons[i];
5922
+ if(button){
5923
+ dataDialog.actions.push({
5924
+ text: button.title,
5925
+ action: button.value,
5926
+ primary: button.primaryValue == 'true' ? true : null
5927
+ });
5928
+
5929
+ hasButton = true;
5930
+
5931
+ }
5932
+ };
5933
+
5934
+ // If you have not added a button to the modal. Add to be able to close the modal.
5935
+ if(!hasButton){
5936
+ dataDialog.actions.push({
5937
+ text: "OK",
5938
+ primary: true
5939
+ });
5940
+ };
5941
+
5942
+ }
5943
+
5944
+ };
5945
+
5946
+ /**
5947
+ * @type function
5948
+ * @name {{buttonConfirmDialogAlert}}
5949
+ * @nameTags confirmDialog | botão | button | alert | modal | alerta
5950
+ * @description {{buttonConfirmDialogAlertDescription}}
5951
+ * @platform W
5952
+ * @param {ObjectType.BOOLEAN} primaryButton {{buttonConfirmDialogAlert.primaryButton}}
5953
+ * @param {ObjectType.STRING} title {{title}}
5954
+ * @param {ObjectType.STRING} value {{buttonConfirmDialogAlert.value}}
5955
+ * @returns {ObjectType.OBJECT}
5785
5956
  */
5957
+ this.cronapi.notification.buttonConfirmDialogAlert = function (/** @type {ObjectType.STRING} @description {{buttonConfirmDialogAlert.primaryButton}} @blockType util_dropdown @keys true|false @values {{yes}}|{{no}} */ primaryButton, title, /** @type {ObjectType.STATEMENT} @description {{buttonConfirmDialogAlert.value}} */ value) {
5958
+ return {
5959
+ title: title,
5960
+ value: value,
5961
+ primaryValue: primaryButton
5962
+ };
5963
+ };
5786
5964
 
5965
+ /**
5966
+ * @category {{CategoryType.REGEX}}
5967
+ * @categoryTags REGEX|regex
5968
+ */
5787
5969
  this.cronapi.regex = {};
5788
5970
 
5789
5971
  /**
@@ -5850,7 +6032,7 @@ if (!window.fixedTimeZone) {
5850
6032
  }
5851
6033
 
5852
6034
  /**
5853
- * @category Calendar
6035
+ * @category {{Calendar}}
5854
6036
  * @categoryTags calendar|calendário
5855
6037
  */
5856
6038
  this.cronapi.calendar = {};
@@ -6438,7 +6620,7 @@ if (!window.fixedTimeZone) {
6438
6620
  * @description {{setCookieDesc}}
6439
6621
  * @param {ObjectType.STRING} key {{key}}
6440
6622
  * @param {ObjectType.STRING} value {{value}}
6441
- * @param {ObjectType.STRING} measurementUnit {{measurementUnit}}
6623
+ * @param {ObjectType.STRING} measurementUnit {{measurementUnit}}
6442
6624
  * @param {ObjectType.LONG} expires {{expirationTime}}
6443
6625
  */
6444
6626
  this.cronapi.util.setCookie = function (key, value,/**@type {ObjectType.STRING} @description {{measurementUnit}} @blockType util_dropdown @keys seconds|minutes|hours|days @values {{seconds}}|{{minutes}}|{{hours}}|{{days}} */ measurementUnit, expires) {
@@ -6501,4 +6683,168 @@ if (!window.fixedTimeZone) {
6501
6683
 
6502
6684
  }
6503
6685
 
6504
- }).bind(window)();
6686
+ /**
6687
+ * @category CategoryType.MAP
6688
+ * @categoryTags map|mapa|keypair
6689
+ */
6690
+ this.cronapi.map = {};
6691
+
6692
+ /**
6693
+ * @type function
6694
+ * @name {{createMap}}
6695
+ * @description {{createMapDesc}}
6696
+ * @wizard maps_create_with
6697
+ * @param {ObjectType.OBJECT} values {{createMapVariableParam0}}
6698
+ * @returns {ObjectType.MAP}
6699
+ */
6700
+ this.cronapi.map.createMap = function(values) {
6701
+ return values;
6702
+ };
6703
+
6704
+ /**
6705
+ * @type function
6706
+ * @name {{setMapValueByKey}}
6707
+ * @description {{setMapValueByKeyDesc}}
6708
+ * @param {ObjectType.MAP} map {{setMapValueByKeyParam0}}
6709
+ * @param {ObjectType.STRING} field {{setMapValueByKeyParam1}}
6710
+ * @param {ObjectType.STRING} value {{setMapValueByKeyParam2}}
6711
+ */
6712
+ this.cronapi.map.setMapValueByKey = function(map, field, value) {
6713
+ const arr = {[field]: value};
6714
+ map.push(arr);
6715
+ };
6716
+
6717
+ /**
6718
+ * @type function
6719
+ * @name {{setMapValueByPath}}
6720
+ * @description {{setMapValueByPathDesc}}
6721
+ * @param {ObjectType.MAP} map {{setMapValueByPathParam0}}
6722
+ * @param {ObjectType.STRING} path {{setMapValueByPathParam1}}
6723
+ * @param {ObjectType.STRING} value {{setMapValueByPathParam2}}
6724
+ */
6725
+ this.cronapi.map.setMapValueByPath = function(map, path, value) {
6726
+ const content = {};
6727
+ const keys = path.split('.');
6728
+ const lastKey = keys.pop();
6729
+ const lastObj = keys.reduce((content, key) => content[key] = content[key] || {}, content);
6730
+ lastObj[lastKey] = value;
6731
+ map.push(content);
6732
+ };
6733
+
6734
+ /**
6735
+ * @type function
6736
+ * @name {{getMapValueByPath}}
6737
+ * @description {{getMapValueByPathDesc}}
6738
+ * @param {ObjectType.MAP} map {{getMapValueByPathParam0}}
6739
+ * @param {ObjectType.STRING} path {{getMapValueByPathParam1}}
6740
+ * @returns {ObjectType.STRING}
6741
+ */
6742
+ this.cronapi.map.getMapValueByPath = function(map, path) {
6743
+ let object = null;
6744
+ map.forEach(element => {
6745
+ object = element;
6746
+ const parts = path.split('.');
6747
+ while(parts.length) {
6748
+ const property = parts.shift();
6749
+ if (!(object.hasOwnProperty(property))) {
6750
+ break;
6751
+ }
6752
+ object = object[property];
6753
+ }
6754
+ });
6755
+ return object;
6756
+ };
6757
+
6758
+ /**
6759
+ * @type function
6760
+ * @name {{getMapValueByKey}}
6761
+ * @description {{getMapValueByKeyDesc}}
6762
+ * @param {ObjectType.MAP} map {{getMapValueByKeyParam0}}
6763
+ * @param {ObjectType.STRING} field {{getMapValueByKeyParam1}}
6764
+ * @returns {ObjectType.STRING}
6765
+ */
6766
+ this.cronapi.map.getMapValueByKey = function(map, field) {
6767
+ let object = null;
6768
+ map.forEach(element => {
6769
+ if (element.hasOwnProperty(field)) {
6770
+ object = element[field];
6771
+ }
6772
+ });
6773
+ return object;
6774
+ };
6775
+
6776
+ /**
6777
+ * @category {{breadcrumb}}
6778
+ * @categoryTags breadcrumb | breadcrumbs
6779
+ */
6780
+ this.cronapi.breadcrumb = {};
6781
+
6782
+ /**
6783
+ * @type function
6784
+ * @name {{breadcrumb}}
6785
+ * @description {{breadcrumbDesc}}
6786
+ * @param {ObjectType.MAP} map {{breadcrumbParamMap}}
6787
+ * @returns {ObjectType.STRING}
6788
+ */
6789
+ this.cronapi.breadcrumb.jsonBreadcrumb = function (map) {
6790
+ let breadcrumb = [];
6791
+ map = Array.isArray(map) ? map : [map];
6792
+
6793
+ map.forEach(function (item) {
6794
+ breadcrumb.push(item)
6795
+ });
6796
+ return breadcrumb;
6797
+ };
6798
+
6799
+ /**
6800
+ * @type function
6801
+ * @name {{listBreadcrumb}}
6802
+ * @description {{listBreadcrumbDesc}}
6803
+ * @param {ObjectType.BOOLEAN} root {{listBreadcrumbRoot}}
6804
+ * @param {ObjectType.STRING} titulo {{listBreadcrumbTitulo}}
6805
+ * @param {ObjectType.STRING} link {{listBreadcrumbLink}}
6806
+ * @param {ObjectType.MAP} icon {{listBreadcrumbIcon}}
6807
+ * @returns {ObjectType.STRING}
6808
+ */
6809
+ this.cronapi.breadcrumb.listBreadcrumb = function ( /** @type {ObjectType.BOOLEAN} @description {{listBreadcrumbRoot}} @blockType util_dropdown @keys true|false @values {{yes}}|{{no}} */ root, /** @type {ObjectType.STRING} */ titulo, /** @type {ObjectType.STATEMENT} @description {{listBreadcrumbLink}} */ link, icon) {
6810
+
6811
+ let json = {};
6812
+
6813
+ if (root === 'true' || root === true) {
6814
+ json.type = "rootitem"
6815
+ } else {
6816
+ json.type = "item"
6817
+ }
6818
+
6819
+ json.text = titulo;
6820
+ json.showText = true;
6821
+
6822
+ if (link) {
6823
+ json.href = link
6824
+ } else {
6825
+ json.href = "#"
6826
+ }
6827
+
6828
+ if (icon) {
6829
+ json.icon = icon
6830
+ json.showIcon = true
6831
+ } else {
6832
+ json.showIcon = false
6833
+ }
6834
+
6835
+ return json;
6836
+ };
6837
+
6838
+ }
6839
+
6840
+ (cronapi).bind(window)();
6841
+
6842
+
6843
+ // This is only for test purpose
6844
+ try {
6845
+ if (module) {
6846
+ module.exports = {
6847
+ window
6848
+ };
6849
+ }
6850
+ } catch(err) {}