cronapp-framework-mobile-js 2.8.11 → 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.
Files changed (41) hide show
  1. package/components/crn-button-bar.components.json +1 -1
  2. package/components/crn-checkbox.components.json +2 -1
  3. package/components/crn-dynamic-image.components.json +9 -0
  4. package/components/crn-input-floating.components.json +1 -1
  5. package/components/crn-ion-footer-bar.components.json +2 -2
  6. package/components/crn-ion-segment-item.components.json +4 -1
  7. package/components/crn-ion-segment.components.json +1 -1
  8. package/components/crn-item-swipe.components.json +1 -1
  9. package/components/crn-multiselect.components.json +1 -1
  10. package/components/crn-range.components.json +1 -1
  11. package/components/crn-signature-pad.components.json +36 -0
  12. package/components/templates/checkbox.template.html +6 -7
  13. package/components/templates/crn-ion-segment-item.template.html +1 -1
  14. package/components/templates/crn-ion-segment.template.html +4 -4
  15. package/components/templates/crn-signature-pad.designtime.html +31 -0
  16. package/components/templates/crn-signature-pad.template.html +1 -0
  17. package/css/app.css +10 -0
  18. package/css/signup.css +13 -0
  19. package/dist/components/templates/checkbox.template.html +1 -1
  20. package/dist/components/templates/crn-ion-segment-item.template.html +1 -1
  21. package/dist/components/templates/crn-ion-segment.template.html +1 -1
  22. package/dist/components/templates/crn-signature-pad.designtime.html +22 -0
  23. package/dist/components/templates/crn-signature-pad.template.html +1 -0
  24. package/dist/css/app.css +1 -1
  25. package/dist/css/signup.css +1 -0
  26. package/dist/i18n/locale_en_us.json +3 -1
  27. package/dist/i18n/locale_pt_br.json +4 -1
  28. package/dist/img/cron-icon/crn-signature-pad.svg +1 -0
  29. package/dist/js/app.authentication.js +1 -1
  30. package/dist/js/controllers.authentication.js +1 -1
  31. package/dist/js/directives.js +2 -2
  32. package/dist/js/reports/reports.service.js +1 -1
  33. package/i18n/locale_en_us.json +3 -1
  34. package/i18n/locale_pt_br.json +4 -1
  35. package/img/cron-icon/crn-signature-pad.svg +27 -0
  36. package/js/app.authentication.js +8 -1
  37. package/js/controllers.authentication.js +50 -0
  38. package/js/directives.js +198 -105
  39. package/js/reports/reports.service.js +6 -26
  40. package/package.json +4 -2
  41. package/postupdate.json +11 -0
package/js/directives.js CHANGED
@@ -615,87 +615,85 @@ window.addEventListener('message', function(event) {
615
615
  }
616
616
  }
617
617
  }
618
- })
619
-
620
- .directive('crnAllowNullValues', [function () {
621
- return {
622
- restrict: 'A',
623
- require: '?ngModel',
624
- link: function (scope, el, attrs, ctrl) {
625
- ctrl.$formatters = [];
626
- ctrl.$parsers = [];
627
- let falseValue = attrs.ngFalseValue ? attrs.ngFalseValue.split("'").join("") : "false";
628
- let trueValue = attrs.ngTrueValue ? attrs.ngTrueValue.split("'").join("") : "true";
629
-
630
- if (attrs.crnAllowNullValues == 'true') {
631
- ctrl.$render = function () {
632
- let viewValue = ctrl.$viewValue;
633
- el.data('checked', viewValue);
634
- switch (viewValue) {
635
- case true:
636
- case trueValue:
637
- el.removeAttr('indeterminate');
638
- el.prop('checked', true);
639
- break;
640
- case false:
641
- case falseValue:
642
- el.removeAttr('indeterminate');
643
- el.prop('checked', false);
644
- break;
645
- default:
646
- el.attr('indeterminate', true);
647
- }
648
- };
649
- el.bind('click', function () {
650
- let checked;
651
- switch (el.data('checked')) {
652
- case false:
653
- case falseValue:
654
- checked = attrs.ngTrueValue ? trueValue : true;
655
- break;
656
- default:
657
- checked = attrs.ngFalseValue ? falseValue : false;
658
- }
659
- ctrl.$setViewValue(checked);
660
- scope.$apply(ctrl.$render);
661
- });
662
- } else if (attrs.crnAllowNullValues == 'false'){
663
- ctrl.$render = function () {
664
- let viewValue = ctrl.$viewValue;
665
- if(viewValue === undefined || viewValue === null){
666
- ctrl.$setViewValue(false);
667
- viewValue = false;
668
- }
669
- el.data('checked', viewValue);
670
- switch (viewValue) {
671
- case true:
672
- case trueValue:
673
- el.removeAttr('indeterminate');
674
- el.prop('checked', true);
675
- break;
676
- default:
677
- el.removeAttr('indeterminate');
678
- el.prop('checked', false);
679
- break;
680
- }
681
- };
682
- el.bind('click', function () {
683
- let checked;
684
- switch (el.data('checked')) {
685
- case false:
686
- case falseValue:
687
- checked = attrs.ngTrueValue ? trueValue : true;
688
- break;
689
- default:
690
- checked = attrs.ngFalseValue ? falseValue : false;
691
- }
692
- ctrl.$setViewValue(checked);
693
- scope.$apply(ctrl.$render);
694
- });
695
- }
696
- }
697
- };
698
- }])
618
+ })
619
+
620
+ .directive('crnAllowNullValues', [function () {
621
+ return {
622
+ restrict: 'A',
623
+ require: '?ngModel',
624
+ link: function (scope, el, attrs, ctrl) {
625
+ ctrl.$formatters = [];
626
+ ctrl.$parsers = [];
627
+ let falseValue = attrs.ngFalseValue ? attrs.ngFalseValue.split("'").join("") : false;
628
+ let trueValue = attrs.ngTrueValue ? attrs.ngTrueValue.split("'").join("") : true;
629
+
630
+ if (attrs.crnAllowNullValues == 'false') {
631
+ ctrl.$render = function () {
632
+ let viewValue = ctrl.$viewValue;
633
+ if (ctrl.$viewValue === undefined || ctrl.$viewValue === null) {
634
+ ctrl.$setViewValue(false);
635
+ viewValue = false;
636
+ }
637
+ if (viewValue === falseValue) {
638
+ let modelForEval = `${el.attr('ng-model')}=${attrs.ngFalseValue}`;
639
+ scope.$eval(modelForEval);
640
+ }
641
+ el.data('checked', viewValue);
642
+ switch (viewValue) {
643
+ case true:
644
+ case trueValue:
645
+ el.removeAttr('indeterminate');
646
+ el.prop('checked', true);
647
+ viewValue = trueValue;
648
+ break;
649
+ default:
650
+ el.removeAttr('indeterminate');
651
+ el.prop('checked', false);
652
+ viewValue = falseValue;
653
+ break;
654
+ }
655
+ setTimeout(() => ctrl.$setViewValue(viewValue));
656
+ };
657
+ } else { // true é o padrão
658
+ ctrl.$render = function () {
659
+ let viewValue = ctrl.$viewValue;
660
+ el.data('checked', viewValue);
661
+ switch (viewValue) {
662
+ case true:
663
+ case trueValue:
664
+ el.removeAttr('indeterminate');
665
+ el.prop('checked', true);
666
+ viewValue = trueValue;
667
+ break;
668
+ case false:
669
+ case falseValue:
670
+ el.removeAttr('indeterminate');
671
+ el.prop('checked', false);
672
+ viewValue = falseValue;
673
+ break;
674
+ default:
675
+ viewValue = null;
676
+ el.attr('indeterminate', true);
677
+ }
678
+ setTimeout(() => ctrl.$setViewValue(viewValue));
679
+ };
680
+ }
681
+ el.bind('click', function () {
682
+ let checked;
683
+ switch (el.data('checked')) {
684
+ case false:
685
+ case falseValue:
686
+ checked = attrs.ngTrueValue ? trueValue : true;
687
+ break;
688
+ default:
689
+ checked = attrs.ngFalseValue ? falseValue : false;
690
+ }
691
+ ctrl.$setViewValue(checked);
692
+ scope.$apply(ctrl.$render);
693
+ });
694
+ }
695
+ };
696
+ }])
699
697
 
700
698
  .directive('cronappFilter', function($compile) {
701
699
  var setFilterInButton = function($element, bindedFilter, operator) {
@@ -1736,34 +1734,129 @@ window.addEventListener('message', function(event) {
1736
1734
 
1737
1735
  element.html($templateDyn);
1738
1736
  $compile($templateDyn)(element.scope());
1739
- }
1740
1737
  }
1741
- })
1742
-
1743
- .directive('cronVideo', function ($compile) {
1744
- return {
1745
- restrict: 'AE',
1738
+ }
1739
+ })
1740
+
1741
+ .directive('signaturePad', function($compile, $window) {
1742
+ 'use strict';
1743
+
1744
+ var signaturePad, canvas, element, EMPTY_IMAGE = null;
1745
+ return {
1746
+ restrict: 'E',
1747
+ require: "ngModel",
1748
+ scope: true,
1746
1749
  replace: true,
1747
- link: function (scope, element, attrs) {
1748
-
1749
- var component = element.find('.cronVideo')[0];
1750
- $compile(component)(element.scope());
1751
-
1752
- var componentOptions = element.find('.cronVideoIframe')[0];
1753
- $compile(componentOptions)(element.scope());
1754
-
1755
- var $templateDyn = "";
1756
- var src = attrs.src;
1757
- var width = attrs.width;
1758
- var height = attrs.height;
1759
- var title = attrs.title;
1760
- $templateDyn = `<iframe class="cronVideoIframe" src="${src}" width="${width}" height="${height}" title="${title}" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen> </iframe>`;
1761
-
1762
- element.html($templateDyn);
1763
- $compile($templateDyn)(element.scope());
1750
+ template: '<div>' +
1751
+ '<canvas style="width:100%" ng-click="mouseup()" ng-mouseup="mouseup()"></canvas>' +
1752
+ '<div>' +
1753
+ '<button type="button" style="margin-right:5px;margin-bottom:5px;" ng-click="clear()">{{"clear"|translate}}</button>' +
1754
+ '</div>' +
1755
+ '</div>',
1756
+ scope: {
1757
+ clear: '=',
1758
+ dataurl: '=',
1759
+ height: '@',
1760
+ width: '@',
1761
+ ngClick: '@',
1762
+ ngModel: '='
1763
+ },
1764
+ controller: [
1765
+ '$scope',
1766
+ function($scope) {
1767
+
1768
+ $scope.mouseup = function() {
1769
+
1770
+ var signature = {};
1771
+
1772
+ if (!$scope.signaturePad.isEmpty()) {
1773
+ signature.dataUrl = $scope.signaturePad.toDataURL();
1774
+ signature.isEmpty = false;
1775
+
1776
+ } else {
1777
+ signature.dataUrl = EMPTY_IMAGE;
1778
+ signature.isEmpty = true;
1779
+ }
1780
+
1781
+ if (signature.dataUrl == null) {
1782
+ return;
1783
+ }
1784
+ var binary = signature.dataUrl.split(',')[1];
1785
+ $scope.ngModel = binary;
1786
+ };
1787
+
1788
+ $scope.$watch('ngModel', function(value, old) {
1789
+
1790
+ var signature = $scope.signaturePad;
1791
+ var data = $scope.ngModel;
1792
+
1793
+ if (value !== old) {
1794
+
1795
+ signature.fromDataURL("data:image/png;base64," + value, {
1796
+ ratio: 1
1797
+ });
1798
+ $scope.ngModel = value;
1799
+ signature.clear();
1800
+ }
1801
+ }, true);
1802
+
1803
+ $scope.clear = function() {
1804
+ $scope.signaturePad.clear();
1805
+ $scope.ngModel = null;
1806
+ };
1807
+
1808
+ }
1809
+ ],
1810
+ link: function(scope, element, attrs, ngModelCtrl) {
1811
+
1812
+ canvas = element.find('canvas')[0];
1813
+
1814
+ scope.onResize = function() {
1815
+
1816
+ var canvas = element.find('canvas')[0];
1817
+ var ratio = Math.max($window.devicePixelRatio || 1, 1);
1818
+ canvas.width = canvas.offsetWidth * ratio;
1819
+ canvas.height = canvas.offsetHeight * ratio;
1820
+ canvas.getContext("2d").scale(ratio, ratio);
1821
+ }
1822
+
1823
+ scope.onResize();
1824
+
1825
+ scope.signaturePad = new SignaturePad(canvas);
1826
+
1827
+ angular.element($window).bind('resize', function() {
1828
+ scope.onResize();
1829
+ });
1830
+
1831
+ $compile(element)(element.scope());
1764
1832
  }
1833
+ };
1834
+ })
1835
+
1836
+ .directive('cronVideo', function ($compile) {
1837
+ return {
1838
+ restrict: 'AE',
1839
+ replace: true,
1840
+ link: function (scope, element, attrs) {
1841
+
1842
+ var component = element.find('.cronVideo')[0];
1843
+ $compile(component)(element.scope());
1844
+
1845
+ var componentOptions = element.find('.cronVideoIframe')[0];
1846
+ $compile(componentOptions)(element.scope());
1847
+
1848
+ var $templateDyn = "";
1849
+ var src = attrs.src;
1850
+ var width = attrs.width;
1851
+ var height = attrs.height;
1852
+ var title = attrs.title;
1853
+ $templateDyn = `<iframe class="cronVideoIframe" src="${src}" width="${width}" height="${height}" title="${title}" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen> </iframe>`;
1854
+
1855
+ element.html($templateDyn);
1856
+ $compile($templateDyn)(element.scope());
1765
1857
  }
1766
- });
1858
+ }
1859
+ });
1767
1860
 
1768
1861
  app.directive("kendoChat", function ($compile, $timeout) {
1769
1862
  return {
@@ -50,31 +50,7 @@
50
50
 
51
51
  // open report
52
52
  this.openURLContent = function(url) {
53
- var include = function() {
54
- var frame = $('<iframe/>');
55
- frame.attr('frameborder', 0);
56
- var h = parseInt($(window).height());
57
-
58
- frame.attr('height', h - 200);
59
- frame.attr('width', '100%');
60
- frame.attr('src', url + "?download=false");
61
- var m = $('#reportView .modal-body');
62
- if(m.get(0)) {
63
- m.html(frame);
64
- $('#reportViewContext .modal-dialog').css('width', '95%');
65
- setTimeout(function() {
66
- console.log('open[#reportViewContext]');
67
- $('body').append(context);
68
- $('#reportView').modal();
69
- }, 100);
70
- }
71
- else {
72
- console.log('wait[#reportViewContext]');
73
- setTimeout(include, 200);
74
- }
75
- }
76
-
77
- setTimeout(include, 200);
53
+ openReportOnMobile(url)
78
54
  };
79
55
 
80
56
  this.initializeStimulsoft = function(language) {
@@ -461,6 +437,10 @@
461
437
  }
462
438
  }.bind(this));
463
439
  };
464
-
440
+
441
+ function openReportOnMobile(url) {
442
+ window.open(url, '_system');
443
+ }
444
+
465
445
  });
466
446
  }(app));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cronapp-framework-mobile-js",
3
- "version": "2.8.11",
3
+ "version": "2.9.0",
4
4
  "description": "Javascript library for CronApp's projects",
5
5
  "main": "cronapp.framework.mobile.js",
6
6
  "scripts": {
@@ -57,6 +57,8 @@
57
57
  "ng-file-upload": "12.2.13",
58
58
  "angular-moment": "1.2.0",
59
59
  "pace": "HubSpot/pace#v1.0.2",
60
- "moment": "2.24.0"
60
+ "moment": "2.24.0",
61
+ "cronapp-ion-tab-badge": "1.0.0",
62
+ "signature_pad": "^3.0.0-beta.4"
61
63
  }
62
64
  }
package/postupdate.json CHANGED
@@ -171,6 +171,11 @@
171
171
  "file": "index.html",
172
172
  "script": "node_modules/cronapp-framework-mobile-js/js/reports/reports.service.js",
173
173
  "type": "script"
174
+ },
175
+ {
176
+ "file": "index.html",
177
+ "script": "node_modules/cronapp-ion-tab-badge/dist/index.js",
178
+ "type": "script"
174
179
  }
175
180
  ],
176
181
  "removes": [
@@ -208,6 +213,12 @@
208
213
  "file": "index.html",
209
214
  "script": "plugins/angular-translate/angular-translate.min.js",
210
215
  "type": "script"
216
+ },
217
+ {
218
+ "file": "index.html",
219
+ "script": "node_modules/signature_pad/dist/signature_pad.umd.min.js",
220
+ "type": "script",
221
+ "onTop": true
211
222
  }
212
223
  ],
213
224
  "replaces": [