cronapp-framework-js 2.9.1-SP.2 → 2.9.1-SP.20

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.
@@ -1 +1 @@
1
- (function(){angular.module("report.services",[]).service("ReportService",["$http","$compile","$modal","$translate","$window","$rootScope",function(a,b,c,d,e,f){function g(){return navigator.userAgent.match(/Android/i)||navigator.userAgent.match(/webOS/i)||navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/iPod/i)||navigator.userAgent.match(/BlackBerry/i)||navigator.userAgent.match(/Windows Phone/i)}function h(a){window.open(a,"_blank")}var i=$("body"),j=angular.element(i.get(0)).scope(),k=["node_modules/cronapp-lib-js/dist/js/stimulsoft/stimulsoft.vendor.css","node_modules/cronapp-lib-js/dist/js/stimulsoft/stimulsoft.vendor.js","node_modules/cronapp-lib-js/dist/js/stimulsoft/stimulsoft-helper.js"],l=[];this.getReport=function(b){var c={url:"api/rest/report",method:"POST",data:angular.toJson({reportName:b})};return a(c)},this.getPDF=function(b){var c={url:"api/rest/report/pdf",method:"POST",responseType:"arraybuffer",data:angular.toJson(b)};return a(c)},this.getPDFAsFile=function(b){var c={url:"api/rest/report/pdfasfile",method:"POST",data:angular.toJson(b)};return a(c)},this.getContentAsString=function(b){var c={url:"api/rest/report/contentasstring",method:"POST",data:angular.toJson(b)};return a(c)},this.getDataSourcesParams=function(b){var c={url:"api/rest/report/getdatasourcesparams",method:"POST",data:angular.toJson(b)};return a(c)},this.openURLContent=function(a){if(a&&g())return void h(a);var c=$("#reportViewContext");c.get(0)||(console.log("include[#reportViewContext]"),i.append("<div id=\"reportViewContext\" ng-include=\"'node_modules/cronapp-framework-js/components/reports/reports.view.html'\"></div>"),b(i)(j),c=$("#reportViewContext"));var d=function(){var b=$("<iframe/>");b.attr("frameborder",0);var e=parseInt($(window).height());b.attr("height",e-200),b.attr("width","100%"),b.attr("src",a+"?download=false");var f=$("#reportView .modal-body");f.get(0)?(f.html(b),$("#reportViewContext .modal-dialog").css("width","95%"),setTimeout(function(){console.log("open[#reportViewContext]"),$("body").append(c),$("#reportView").modal()},100)):(console.log("wait[#reportViewContext]"),setTimeout(d,200))};setTimeout(d,200)},this.initializeStimulsoft=function(a){if(!Stimulsoft.Base.StiLicense.Key){stimulsoftHelper.setLanguage(a);var b=stimulsoftHelper.getLocalization();Stimulsoft.Base.Localization.StiLocalization.loadLocalization(b.xml),Stimulsoft.Base.Localization.StiLocalization.cultureName=b.cultureName,Stimulsoft.Base.StiLicense.Key=stimulsoftHelper.getKey()}},this.openStimulsoftReport=function(a,c,d,e){var k=$("#reportViewContext");k.get(0)||(i.append("<div id=\"reportViewContext\" ng-include=\"'node_modules/cronapp-framework-js/components/reports/reports.view.html'\"></div>"),b(i)(j),k=$("#reportViewContext"));var l=parseInt($(window).height()),m=l-200+"px",n="StiViewer"+app.common.generateId(),o=new Stimulsoft.Report.StiReport;f.reportTitle=a.ReportAlias,o.load(a),d||(d=stimulsoftHelper.getDatasourcesInBand(o)),c&&c.forEach(function(a){d.datasources.forEach(function(b){for(var c=0;c<b.fieldParams.length;c++)if(b.fieldParams[c].param==a.originalName){b.fieldParams[c].value=a.value;break}})}),stimulsoftHelper.setParamsInFilter(o.dictionary.dataSources,d.datasources);var p=()=>{var a=new Stimulsoft.Viewer.StiViewerOptions;a.toolbar.showAboutButton=!1,e?(a.toolbar.visible=e.showToolbar,a.appearance.scrollbarsMode=e.showScrollbar,null!=e.height&&(a.height=e.height+"px")):(a.appearance.scrollbarsMode=!0,a.height=m);var b=new Stimulsoft.Viewer.StiViewer(a,n,!1);return b.report=o,Stimulsoft.Viewer.StiJsViewer.prototype.IsTouchDevice()&&(b.options.appearance.interfaceType=Stimulsoft.Viewer.StiInterfaceType.Touch),b};if(e&&e.$element)p(e).renderHtml(e.$element[0]);else{function b(){var a,b,c,d,e,f=setInterval(function(){var g=$("#"+n);g.length?!a&&(a=g.parent(),b=a.parent(),c=b.parent(),d=c.parent(),e=d.parent()):(console.log("cleared interval: "+n),clearInterval(f))},100)}function d(c){if(c&&g())return void h(c);var d=setInterval(function(){var f=$("<div/>");f.attr("id","contentReport"),f.attr("width","100%");var g=$("#reportView .modal-body");g.get(0)&&(g.html(f),$("#reportViewContext .modal-dialog").css("width","95%"),setTimeout(function(){console.log("open[#reportViewContext]"),$("body").append(k),cronapi.screen.showModal("reportView"),a.reportConfig&&"HTML"===a.reportConfig.renderType?p(e).renderHtml("contentReport"):$("#contentReport").html("<iframe src=\""+c+"\" width=\"100%\" height=\""+m+"\"></iframe>"),setTimeout(function(){b()},100)},100),clearInterval(d))},200)}if(!a.reportConfig||"PDFSERVER"===a.reportConfig.renderType)this.getPDF({reportName:a.reportName,parameters:c}).then(function(a){var b=new Blob([new Uint8Array(a.data)],{type:"application/pdf"}),c=URL.createObjectURL(b);d(c)}.bind(this));else{var q=new Stimulsoft.Report.Export.StiPdfExportSettings,r=new Stimulsoft.Report.Export.StiPdfExportService,s=new Stimulsoft.System.IO.MemoryStream;o.renderAsync(function(){a.reportConfig&&"PDF"!==a.reportConfig.renderType&&a.reportConfig.renderType!==void 0?d(null):r.exportToAsync(function(){var a=s.toArray(),b=new Blob([new Uint8Array(a)],{type:"application/pdf"}),c=URL.createObjectURL(b);d(c)},o,s,q)},!1)}}$(`#${n}`).find("img").attr("alt",""),$(`#${n}`).find("input").attr("aria-label",n)},this.showParameters=function(a){var b=a.parameters,d=[],e=0,f=function(a){return a.replace(/([.*+?^=!:()|\[\]\/\\])/g,"\\$1")},g=function(a,b,c){return a.replace(new RegExp(f(b),"g"),c)},h=function(){if(e<b.length){var f=b[e++];$.get("node_modules/cronapp-framework-js/components/reports/"+f.type+".parameter.html").done(function(a){d.push(g(a,"_field_",f.name)),h()})}else 0<d.length&&c.open({templateUrl:"node_modules/cronapp-framework-js/components/reports/reports.parameters.html",controller:"ParameterController",resolve:{report:function(){return JSON.parse(JSON.stringify(a))},htmlParameters:function(){return JSON.parse(JSON.stringify(d))}}})}.bind(this);h()},this.mergeParam=function(a,b){var c=function(a,b){for(var c in Object.keys(b)){var d=Object.keys(b[c])[0];if(a==d)return Object.values(b[c])[0]}};for(var d in Object.keys(a)){var e=a[d].name,f=a[d].value,g=c(e,b);g&&(a[d].value=g)}return a},this.setVariablesBasedOnParams=function(a,b){for(var c in b){var d=Object.keys(b[c])[0],e=b[c][d];for(var f in a)if(a[f]&&a[f].Name&&a[f].Name===d){a[f].Value=e;break}}},this.hasParameterWithOutValue=function(a){for(var b in Object.keys(a))if(!a[b].value)return!0;return!1},this.getDatasourcesInBand=function(a){var b=new Stimulsoft.Report.StiReport;b.load(a);var c=stimulsoftHelper.getDatasourcesInBand(b);return c},this.loadSriptsStimulsoft=function(a){var b=!0,c=k.length,d=0;Pace.options.initialRate=.7,Pace.options.minTime=1750,Pace.options.maxProgressPerFrame=1,Pace.options.ghostTime=12e4;let e=setInterval(()=>Pace.restart(),2500);k.forEach(function(f){this.loadScript(f,function(f){d++,f||(b=!1),d==c&&(clearInterval(e),Pace.options.initialRate=.03,Pace.options.minTime=250,Pace.options.maxProgressPerFrame=20,Pace.options.ghostTime=10,Pace.stop(),a(b))})}.bind(this))},this.loadScript=function(a,b){if(0<=$.inArray(a,l))return void(b&&b(!0));if(-1!=a.indexOf(".css")){var c=document.createElement("link");c.rel="stylesheet",c.type="text/css",c.href=a,c.media="all",c.onload=function(){l.push(a),b&&b(!0)},c.onerror=function(){b&&b(!1)};try{document.getElementsByTagName("head")[0].appendChild(c)}catch(a){console.log(a)}}else{var d=document.createElement("script");d.type="text/javascript",d.readyState?d.onreadystatechange=function(){("loaded"==d.readyState||"complete"==d.readyState)&&(d.onreadystatechange=null,l.push(a),b&&b(!0))}:d.onload=function(){l.push(a),b&&b(!0)},d.src=a,document.getElementsByTagName("head")[0].appendChild(d)}},this.openReport=function(a,b,c){this.getReport(a).then(function(a){a&&a.data&&(a.data.reportName.endsWith(".report")?this.loadSriptsStimulsoft(function(e){e?(this.initializeStimulsoft(d.use()),this.getContentAsString(a.data).then(function(e){var f=this.getDatasourcesInBand(e.data);this.getDataSourcesParams(f).then(function(g){f=g.data,a.data.parameters=stimulsoftHelper.parseToGroupedParam(f.datasources),a.data.contentData=e.data,a.data.datasourcesInBand=f,b&&(a.data.parameters=this.mergeParam(a.data.parameters,b),a.data.contentData.Dictionary=a.data.contentData.Dictionary||{},this.setVariablesBasedOnParams(a.data.contentData.Dictionary.Variables,b)),this.hasParameterWithOutValue(a.data.parameters)&&!c?(a.data.parameters.forEach(function(a){a.name=d.instant(a.name)}),this.showParameters(JSON.parse(JSON.stringify(a.data)))):this.openStimulsoftReport(e.data,a.data.parameters,a.data.datasourcesInBand,c)}.bind(this))}.bind(this),function(a){var b=cronapi.internal.getErrorMessage(a,a.statusText);j.Notification.error(b)}.bind(this))):j.Notification.error("Error loading report script")}.bind(this)):0==a.data.parameters.length||1==a.data.parameters.length&&"DATA_LIMIT"==a.data.parameters[0].name?this.getPDFAsFile(a.data.reportName).then(function(a){this.openURLContent(a.data)}.bind(this),function(a){var b=cronapi.internal.getErrorMessage(a,a.statusText);j.Notification.error(b)}.bind(this)):(b&&(a.data.parameters=this.mergeParam(a.data.parameters,b)),this.hasParameterWithOutValue(a.data.parameters)?this.showParameters(JSON.parse(JSON.stringify(a.data))):this.getPDFAsFile(a.data).then(function(a){this.openURLContent(a.data)}.bind(this))))}.bind(this))}}])})(app);
1
+ (function(){angular.module("report.services",[]).service("ReportService",["$http","$compile","$modal","$translate","$window","$rootScope",function(a,b,c,d,e,f){function g(){return navigator.userAgent.match(/Android/i)||navigator.userAgent.match(/webOS/i)||navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/iPod/i)||navigator.userAgent.match(/BlackBerry/i)||navigator.userAgent.match(/Windows Phone/i)}function h(a){window.open(a,"_blank")}var i=$("body"),j=angular.element(i.get(0)).scope(),k=["node_modules/cronapp-lib-js/dist/js/stimulsoft/stimulsoft.vendor.css","node_modules/cronapp-lib-js/dist/js/stimulsoft/stimulsoft.vendor.js","node_modules/cronapp-lib-js/dist/js/stimulsoft/stimulsoft-helper.js"],l=[];this.getReport=function(b){var c={url:"api/rest/report",method:"POST",data:angular.toJson({reportName:b})};return a(c)},this.getPDF=function(b){var c={url:"api/rest/report/pdf",method:"POST",responseType:"arraybuffer",data:angular.toJson(b)};return a(c)},this.getPDFAsFile=function(b){var c={url:"api/rest/report/pdfasfile",method:"POST",data:angular.toJson(b)};return a(c)},this.getContentAsString=function(b){var c={url:"api/rest/report/contentasstring",method:"POST",data:angular.toJson(b)};return a(c)},this.getDataSourcesParams=function(b){var c={url:"api/rest/report/getdatasourcesparams",method:"POST",data:angular.toJson(b)};return a(c)},this.openURLContent=function(a){if(a&&g())return void h(a);var c=$("#reportViewContext");c.get(0)||(console.log("include[#reportViewContext]"),i.append("<div id=\"reportViewContext\" ng-include=\"'node_modules/cronapp-framework-js/components/reports/reports.view.html'\"></div>"),b(i)(j),c=$("#reportViewContext"));var d=function(){var b=$("<iframe/>");b.attr("frameborder",0);var e=parseInt($(window).height());b.attr("height",e-200),b.attr("width","100%"),b.attr("src",a+"?download=false");var f=$("#reportView .modal-body");f.get(0)?(f.html(b),$("#reportViewContext .modal-dialog").css("width","95%"),setTimeout(function(){console.log("open[#reportViewContext]"),$("body").append(c),$("#reportView").modal()},100)):(console.log("wait[#reportViewContext]"),setTimeout(d,200))};setTimeout(d,200)},this.initializeStimulsoft=function(a){if(!Stimulsoft.Base.StiLicense.Key){stimulsoftHelper.setLanguage(a);var b=stimulsoftHelper.getLocalization();Stimulsoft.Base.Localization.StiLocalization.loadLocalization(b.xml),Stimulsoft.Base.Localization.StiLocalization.cultureName=b.cultureName,Stimulsoft.Base.StiLicense.Key=stimulsoftHelper.getKey()}},this.openStimulsoftReport=function(a,c,d,e){var k=$("#reportViewContext");k.get(0)||(i.append("<div id=\"reportViewContext\" ng-include=\"'node_modules/cronapp-framework-js/components/reports/reports.view.html'\"></div>"),b(i)(j),k=$("#reportViewContext"));var l=parseInt($(window).height()),m=l-200+"px",n="StiViewer"+app.common.generateId(),o=new Stimulsoft.Report.StiReport;f.reportTitle=a.ReportAlias,o.load(a),d||(d=stimulsoftHelper.getDatasourcesInBand(o)),c&&c.forEach(function(a){d.datasources.forEach(function(b){for(var c=0;c<b.fieldParams.length;c++)if(b.fieldParams[c].param==a.originalName){b.fieldParams[c].value=a.value;break}})}),stimulsoftHelper.setParamsInFilter(o.dictionary.dataSources,d.datasources);var p=()=>{var a=new Stimulsoft.Viewer.StiViewerOptions;a.toolbar.showAboutButton=!1,e?(a.toolbar.visible=e.showToolbar,a.appearance.scrollbarsMode=e.showScrollbar,null!=e.height&&(a.height=e.height+"px")):(a.appearance.scrollbarsMode=!0,a.height=m);var b=new Stimulsoft.Viewer.StiViewer(a,n,!1);return b.report=o,Stimulsoft.Viewer.StiJsViewer.prototype.IsTouchDevice()&&(b.options.appearance.interfaceType=Stimulsoft.Viewer.StiInterfaceType.Touch),b};if(e&&e.$element)p(e).renderHtml(e.$element[0]);else{function b(){var a,b,c,d,e,f=setInterval(function(){var g=$("#"+n);g.length?!a&&(a=g.parent(),b=a.parent(),c=b.parent(),d=c.parent(),e=d.parent()):(console.log("cleared interval: "+n),clearInterval(f))},100)}function d(c){if(c&&g())return void h(c);var d=setInterval(function(){var f=$("<div/>");f.attr("id","contentReport"),f.attr("width","100%");var g=$("#reportView .modal-body");g.get(0)&&(g.html(f),$("#reportViewContext .modal-dialog").css("width","95%"),setTimeout(function(){console.log("open[#reportViewContext]"),$("body").append(k),cronapi.screen.showModal("reportView"),a.reportConfig&&"HTML"===a.reportConfig.renderType?p(e).renderHtml("contentReport"):$("#contentReport").html("<iframe src=\""+c+"\" width=\"100%\" height=\""+m+"\"></iframe>"),setTimeout(function(){b()},100)},100),clearInterval(d))},200)}if(!a.reportConfig||"PDFSERVER"===a.reportConfig.renderType)this.getPDF({reportName:a.reportName,parameters:c}).then(function(a){var b=new Blob([new Uint8Array(a.data)],{type:"application/pdf"}),c=URL.createObjectURL(b);d(c)}.bind(this));else{var q=new Stimulsoft.Report.Export.StiPdfExportSettings,r=new Stimulsoft.Report.Export.StiPdfExportService,s=new Stimulsoft.System.IO.MemoryStream;o.renderAsync(function(){a.reportConfig&&"PDF"!==a.reportConfig.renderType&&a.reportConfig.renderType!==void 0?d(null):r.exportToAsync(function(){var a=s.toArray(),b=new Blob([new Uint8Array(a)],{type:"application/pdf"}),c=URL.createObjectURL(b);d(c)},o,s,q)},!1)}}$(`#${n}`).find("img").attr("alt",""),$(`#${n}`).find("input").attr("aria-label",n)},this.showParameters=function(a){var b=a.parameters,d=[],e=0,f=function(a){return a.replace(/([.*+?^=!:()|\[\]\/\\])/g,"\\$1")},g=function(a,b,c){return a.replace(new RegExp(f(b),"g"),c)},h=function(){if(e<b.length){var f=b[e++];$.get("node_modules/cronapp-framework-js/components/reports/"+f.type+".parameter.html").done(function(a){d.push(g(a,"_field_",f.name)),h()})}else 0<d.length&&c.open({templateUrl:"node_modules/cronapp-framework-js/components/reports/reports.parameters.html",controller:"ParameterController",resolve:{report:function(){return JSON.parse(JSON.stringify(a))},htmlParameters:function(){return JSON.parse(JSON.stringify(d))}}})}.bind(this);h()},this.mergeParam=function(a,b){var c=function(a,b){for(var c in Object.keys(b))if(d(b[c])){var e=Object.keys(b[c])[0];if(a==e)return Object.values(b[c])[0]}};let d=a=>{let b={}.constructor;return a&&b===a.constructor};for(var e in Object.keys(a)){var f=a[e].name,g=a[e].value,h=c(f,b);h?a[e].value=h:Array.isArray(b)&&!d(b[e])&&(a[e].value=b[e])}return a},this.setVariablesBasedOnParams=function(a,b){for(var c in b){var d=Object.keys(b[c])[0],e=b[c][d];for(var f in a)if(a[f]&&a[f].Name&&a[f].Name===d){a[f].Value=e;break}}},this.hasParameterWithOutValue=function(a){var b=!1;for(var c in Object.keys(a))if(!a[c].value)return!0;return!1},this.getDatasourcesInBand=function(a){var b=new Stimulsoft.Report.StiReport;b.load(a);var c=stimulsoftHelper.getDatasourcesInBand(b);return c},this.loadSriptsStimulsoft=function(a){var b=!0,c=k.length,d=0;Pace.options.initialRate=.7,Pace.options.minTime=1750,Pace.options.maxProgressPerFrame=1,Pace.options.ghostTime=12e4;let e=setInterval(()=>Pace.restart(),2500);k.forEach(function(f,g){this.loadScript(f,function(f){d++,f||(b=!1),d==c&&(clearInterval(e),Pace.options.initialRate=.03,Pace.options.minTime=250,Pace.options.maxProgressPerFrame=20,Pace.options.ghostTime=10,Pace.stop(),a(b))})}.bind(this))},this.loadScript=function(a,b){if(0<=$.inArray(a,l))return void(b&&b(!0));if(-1!=a.indexOf(".css")){var c=document.createElement("link");c.rel="stylesheet",c.type="text/css",c.href=a,c.media="all",c.onload=function(){l.push(a),b&&b(!0)},c.onerror=function(){b&&b(!1)};try{document.getElementsByTagName("head")[0].appendChild(c)}catch(a){console.log(a)}}else{var d=document.createElement("script");d.type="text/javascript",d.readyState?d.onreadystatechange=function(){("loaded"==d.readyState||"complete"==d.readyState)&&(d.onreadystatechange=null,l.push(a),b&&b(!0))}:d.onload=function(){l.push(a),b&&b(!0)},d.src=a,document.getElementsByTagName("head")[0].appendChild(d)}},this.openReport=function(a,b,c){this.getReport(a).then(function(a){a&&a.data&&(a.data.reportName.endsWith(".report")?this.loadSriptsStimulsoft(function(e){e?(this.initializeStimulsoft(d.use()),this.getContentAsString(a.data).then(function(e){var f=this.getDatasourcesInBand(e.data);this.getDataSourcesParams(f).then(function(g){f=g.data,a.data.parameters=stimulsoftHelper.parseToGroupedParam(f.datasources),a.data.contentData=e.data,a.data.datasourcesInBand=f,b&&(a.data.parameters=this.mergeParam(a.data.parameters,b),a.data.contentData.Dictionary=a.data.contentData.Dictionary||{},this.setVariablesBasedOnParams(a.data.contentData.Dictionary.Variables,b)),this.hasParameterWithOutValue(a.data.parameters)&&!c?(a.data.parameters.forEach(function(a){a.name=d.instant(a.name)}),this.showParameters(JSON.parse(JSON.stringify(a.data)))):this.openStimulsoftReport(e.data,a.data.parameters,a.data.datasourcesInBand,c)}.bind(this))}.bind(this),function(a){var b=cronapi.internal.getErrorMessage(a,a.statusText);j.Notification.error(b)}.bind(this))):j.Notification.error("Error loading report script")}.bind(this)):0==a.data.parameters.length||1==a.data.parameters.length&&"DATA_LIMIT"==a.data.parameters[0].name?this.getPDFAsFile(a.data.reportName).then(function(a){this.openURLContent(a.data)}.bind(this),function(a){var b=cronapi.internal.getErrorMessage(a,a.statusText);j.Notification.error(b)}.bind(this)):(b&&(a.data.parameters=this.mergeParam(a.data.parameters,b)),this.hasParameterWithOutValue(a.data.parameters)?this.showParameters(JSON.parse(JSON.stringify(a.data))):this.getPDFAsFile(a.data).then(function(a){this.openURLContent(a.data)}.bind(this))))}.bind(this))}}])})(app);
package/js/directives.js CHANGED
@@ -38,11 +38,17 @@
38
38
  enabled: {
39
39
  public: true
40
40
  },
41
+ render: {
42
+ public: true
43
+ },
41
44
  notvisible: {
42
45
  public: false
43
46
  },
44
47
  notenabled: {
45
48
  public: false
49
+ },
50
+ notrender: {
51
+ public: false
46
52
  }
47
53
  }
48
54
 
@@ -588,6 +594,9 @@
588
594
  restrict: 'A',
589
595
  priority: Number.MIN_SAFE_INTEGER,
590
596
  link: function(scope, element, attrs) {
597
+ if (attrs.cronappSecurity == '' || attrs.cronappSecurity == undefined || attrs.cronappSecurity == null) {
598
+ return;
599
+ }
591
600
  var roles = [];
592
601
  var user = JSON.parse(localStorage.getItem('_u'))
593
602
  if (user && user.roles) {
@@ -597,6 +606,7 @@
597
606
  var perms = parsePermission(attrs.cronappSecurity);
598
607
  var show = false;
599
608
  var enabled = false;
609
+ var render = false;
600
610
  for (var i=0;i<roles.length;i++) {
601
611
  var role = roles[i].trim();
602
612
  if (role) {
@@ -606,6 +616,9 @@
606
616
  if (perms.enabled[role]) {
607
617
  enabled = true;
608
618
  }
619
+ if (perms.render[role]) {
620
+ render = true;
621
+ }
609
622
  }
610
623
  }
611
624
 
@@ -618,6 +631,9 @@
618
631
  if (perms.notenabled[role]) {
619
632
  enabled = false;
620
633
  }
634
+ if (perms.notrender[role]) {
635
+ render = false;
636
+ }
621
637
  }
622
638
  }
623
639
 
@@ -629,6 +645,9 @@
629
645
  if (!enabled) {
630
646
  $element.find('*').addBack().attr('disabled', true).off('click').on('click', e => e.preventDefault());
631
647
  }
648
+ if (!render) {
649
+ $element.remove();
650
+ }
632
651
  };
633
652
 
634
653
  let wait = setInterval(()=>{
@@ -3047,7 +3066,7 @@
3047
3066
  row.cells[cellIndex].format = "dd/mm/yyyy hh:mm:ss;@";
3048
3067
  }
3049
3068
 
3050
- if (row.type === "footer") {
3069
+ if (row.type === "footer" || row.type === "group-footer") {
3051
3070
  if (row.cells[cellIndex].value) {
3052
3071
  let rawValue = row.cells[cellIndex].value;
3053
3072
  let content = $(rawValue)[0].innerHTML;
@@ -3133,10 +3152,7 @@
3133
3152
  },
3134
3153
  change: function(e) {
3135
3154
  var item = this.dataItem(this.select());
3136
- let manyHiddenSelect = $('[data-component="crn-enterprise-dynamic-combobox"]').length > 1 && !$('[data-component="crn-enterprise-dynamic-combobox"]').is(':visible');
3137
- if (!manyHiddenSelect) {
3138
- setToActiveInCronappDataSource.bind(this)(item);
3139
- }
3155
+ setToActiveInCronappDataSource.bind(this)(item);
3140
3156
  var cronappDatasource = this.dataSource.transport.options.cronappDatasource;
3141
3157
  if(options.fieldType && options.fieldType === 'key'){
3142
3158
  cronappDatasource.active = helperDirective.changeObjectField(cronappDatasource, cronappDatasource.active);
@@ -3680,7 +3696,6 @@
3680
3696
  var parent = element.parent();
3681
3697
  $(parent).append('<input style="width: 100%;" '+ id + name + ' class="cronSelect"/>');
3682
3698
  var $element = $(parent).find('input.cronSelect');
3683
- var cronDisabled = attrs.cronDisabled;
3684
3699
  var options = await app.kendoHelper.getConfigCombobox(select, scope);
3685
3700
  options.close = attrs.ngClose ? function (){scope.$eval(attrs.ngClose)}: undefined;
3686
3701
  options.dataBound = attrs.ngDataBound ? function (){scope.$eval(attrs.ngDataBound)}: undefined;
@@ -3732,11 +3747,9 @@
3732
3747
  }
3733
3748
  };
3734
3749
  initializeAttrAndEvents();
3735
- if (cronDisabled) {
3736
- combobox.enable(false);
3737
- } else {
3738
- combobox.enable(true);
3739
- }
3750
+ scope.$watch(attrs.cronDisabled, function(newValue) {
3751
+ combobox.enable(!newValue);
3752
+ });
3740
3753
 
3741
3754
  var _scope = scope;
3742
3755
  var _ngModelCtrl = ngModelCtrl;
@@ -3902,7 +3915,6 @@
3902
3915
  var self = this;
3903
3916
  var parentDS = {};
3904
3917
  var textField = null;
3905
- var cronDisabled = attrs.cronDisabled;
3906
3918
  try {
3907
3919
  select = JSON.parse(attrs.options);
3908
3920
  parentDS = this.getActive(attrs.ngModel);
@@ -4129,16 +4141,25 @@
4129
4141
  }
4130
4142
  }
4131
4143
 
4144
+ let returnTypedValue = (value) => {
4145
+ if (dataSourceScreen.schema) {
4146
+ let fieldInfo = dataSourceScreen.schema.find(s=> s.name === options.dataValueField);
4147
+ if (fieldInfo && fieldInfo.type !== 'String') {
4148
+ value = parseFloat(value) || value;
4149
+ }
4150
+ }
4151
+ return value;
4152
+ };
4153
+
4132
4154
  /**
4133
4155
  * Observa o read do datasource para setar o primeiro valor ou valor inicial.
4134
4156
  */
4135
-
4136
4157
  var defineInitialValue = function() {
4137
4158
  if (combobox.definingInitialValue) {
4138
4159
  return;
4139
4160
  }
4140
4161
  if (!combobox.isEvaluating) {
4141
- var currentValue = combobox.value();
4162
+ var currentValue = returnTypedValue(combobox.value());
4142
4163
  var nextValue = null;
4143
4164
 
4144
4165
  var found = dataSourceScreen.goTo(currentValue);
@@ -4325,11 +4346,9 @@
4325
4346
 
4326
4347
  $(element).remove();
4327
4348
 
4328
- if(cronDisabled){
4329
- combobox.enable(false);
4330
- } else {
4331
- combobox.enable(true);
4332
- }
4349
+ scope.$watch(attrs.cronDisabled, function(newValue) {
4350
+ combobox.enable(!newValue);
4351
+ });
4333
4352
 
4334
4353
  $("[aria-owns='" + `${attrs.id}_listbox` + "']").attr('aria-label', $translate.instant('template.crud.search'));
4335
4354
  }
@@ -4344,7 +4363,6 @@
4344
4363
  var modelGetter = $parse(attrs['ngModel']);
4345
4364
  var modelSetter = modelGetter.assign;
4346
4365
  var model = attrs['ngModel'];
4347
- var cronDisabled = attrs.cronDisabled;
4348
4366
 
4349
4367
  var _self = this;
4350
4368
  var select = {};
@@ -4481,11 +4499,9 @@
4481
4499
  deselect = attrs.ngDeselect ? function (){_scope.$eval(attrs.ngDeselect)}: undefined;
4482
4500
 
4483
4501
  var combobox = $element.kendoMultiSelect(options).data('kendoMultiSelect');
4484
- if(cronDisabled){
4485
- combobox.enable(false);
4486
- }else {
4487
- combobox.enable(true);
4488
- }
4502
+ scope.$watch(attrs.cronDisabled, function(newValue) {
4503
+ combobox.enable(!newValue);
4504
+ });
4489
4505
  app.kendoHelper.receivePushData(combobox);
4490
4506
 
4491
4507
  $("[aria-describedby='" + `${attrs.id}_taglist` + "']").attr('id', `${attrs.id}-container`);
@@ -4555,7 +4571,6 @@
4555
4571
  options.select = attrs.ngSelect ? function (){scope.$eval(attrs.ngSelect);}: undefined;
4556
4572
  var parent = element.parent();
4557
4573
  var id = attrs.id ? ' id="' + attrs.id + '"' : '';
4558
- var cronDisabled = attrs.cronDisabled;
4559
4574
  var name = attrs.name ? ' name="' + attrs.name + '"' : '';
4560
4575
  var validationmessage = attrs.validationmessage ? ' validationmessage="' + attrs.validationmessage + '"' : '';
4561
4576
  var required = '';
@@ -4588,11 +4603,9 @@
4588
4603
 
4589
4604
  var autoComplete = $element.kendoAutoComplete(options).data('kendoAutoComplete');
4590
4605
 
4591
- if(cronDisabled){
4592
- autoComplete.enable(false);
4593
- } else {
4594
- autoComplete.enable(true);
4595
- }
4606
+ scope.$watch(attrs.cronDisabled, function(newValue) {
4607
+ autoComplete.enable(!newValue);
4608
+ });
4596
4609
 
4597
4610
  if (ngModelCtrl) {
4598
4611
  ngModelCtrl.$formatters.push(function (value) {
@@ -5349,6 +5362,16 @@
5349
5362
  ctrl.$formatters = [];
5350
5363
  ctrl.$parsers = [];
5351
5364
 
5365
+ let rawValueToAngularPattern = (value) => {
5366
+ if (value && value.indexOf("'") === -1) {
5367
+ value = `'${value}'`;
5368
+ }
5369
+ return value;
5370
+ }
5371
+
5372
+ attrs.ngFalseValue = rawValueToAngularPattern(attrs.ngFalseValue);
5373
+ attrs.ngTrueValue = rawValueToAngularPattern(attrs.ngTrueValue);
5374
+
5352
5375
  let falseValue = attrs.ngFalseValue ? attrs.ngFalseValue.split("'").join("") : false;
5353
5376
  let trueValue = attrs.ngTrueValue ? attrs.ngTrueValue.split("'").join("") : true;
5354
5377
 
@@ -5452,74 +5475,83 @@
5452
5475
  '$scope',
5453
5476
  function($scope) {
5454
5477
 
5455
- $scope.mouseup = function() {
5456
-
5457
- var signature = {};
5458
-
5459
- if (!$scope.signaturePad.isEmpty()) {
5460
- signature.dataUrl = $scope.signaturePad.toDataURL();
5461
- signature.isEmpty = false;
5462
-
5463
- } else {
5464
- signature.dataUrl = EMPTY_IMAGE;
5465
- signature.isEmpty = true;
5466
- }
5478
+ let getBinaryFromSignature = () => {
5479
+ let binary = $scope.signaturePad.toDataURL();
5480
+ if (binary) {
5481
+ binary = binary.split(',')[1];
5482
+ }
5483
+ return binary;
5484
+ }
5467
5485
 
5468
- if (signature.dataUrl == null) {
5469
- return;
5470
- }
5471
- var binary = signature.dataUrl.split(',')[1];
5472
- $scope.ngModel = binary;
5473
- };
5486
+ $scope.mouseup = function(e) {
5487
+ if (!$scope.signaturePad.isEmpty()) {
5488
+ $scope.ngModel = getBinaryFromSignature();
5489
+ }
5490
+ };
5474
5491
 
5475
- $scope.$watch('ngModel', function(value, old) {
5492
+ $scope.$watch('ngModel', function(value, old) {
5493
+ if (value !== old) {
5494
+ if (getBinaryFromSignature() !== value) {
5495
+ $scope.signaturePad.fromDataURL("data:image/png;base64," + value, {
5496
+ ratio: 1
5497
+ });
5498
+ }
5499
+ $scope.ngModel = value;
5500
+ }
5501
+ }, true);
5476
5502
 
5477
- if (value !== old) {
5478
- $scope.signaturePad.fromDataURL("data:image/png;base64," + value, {
5479
- ratio: 1
5480
- });
5481
- $scope.ngModel = value;
5482
- }
5483
- }, true);
5503
+ $scope.clear = function() {
5504
+ $scope.signaturePad.clear();
5505
+ $scope.ngModel = null;
5506
+ };
5507
+ }
5508
+ ],
5509
+ link: function(scope, element, attrs, ngModelCtrl, $timeout) {
5510
+ canvas = element.find('canvas')[0];
5484
5511
 
5485
- $scope.clear = function() {
5486
- $scope.signaturePad.clear();
5487
- $scope.ngModel = null;
5488
- };
5512
+ scope.onResize = function() {
5513
+ var ratio = Math.max($window.devicePixelRatio || 1, 1);
5514
+ var canvas = element.find('canvas')[0];
5489
5515
 
5490
- }
5491
- ],
5492
- link: function(scope, element, attrs, ngModelCtrl) {
5493
- canvas = element.find('canvas')[0];
5516
+ var refCanvas = document.createElement('canvas');
5517
+ refCanvas.width = canvas.width;
5518
+ refCanvas.height = canvas.height;
5519
+ var refCtx = refCanvas.getContext('2d');
5520
+ refCtx.drawImage(canvas, 0, 0);
5494
5521
 
5495
- scope.onResize = function() {
5496
- var ratio = Math.max($window.devicePixelRatio || 1, 1);
5497
- var canvas = element.find('canvas')[0];
5522
+ canvas.width = canvas.offsetWidth * ratio;
5523
+ canvas.height = canvas.offsetHeight * ratio;
5524
+ canvas.getContext("2d").drawImage(refCanvas, 0, 0);
5525
+ canvas.getContext("2d").scale(ratio, ratio);
5526
+ };
5498
5527
 
5499
- var refCanvas = document.createElement('canvas');
5500
- refCanvas.width = canvas.width;
5501
- refCanvas.height = canvas.height;
5502
- var refCtx = refCanvas.getContext('2d');
5503
- refCtx.drawImage(canvas, 0, 0);
5528
+ scope.onResize();
5504
5529
 
5505
- canvas.width = canvas.offsetWidth * ratio;
5506
- canvas.height = canvas.offsetHeight * ratio;
5507
- canvas.getContext("2d").drawImage(refCanvas, 0, 0);
5508
- canvas.getContext("2d").scale(ratio, ratio);
5509
- }
5530
+ scope.signaturePad = new SignaturePad(canvas);
5510
5531
 
5511
- scope.onResize();
5532
+ angular.element($window).on('resize', function() {
5533
+ scope.onResize();
5534
+ });
5512
5535
 
5513
- scope.signaturePad = new SignaturePad(canvas);
5536
+ $compile(element)(element.scope());
5514
5537
 
5515
- angular.element($window).on('resize', function() {
5516
- scope.onResize();
5517
- });
5538
+ let mouseButtonDown = false;
5539
+ $(canvas).on('pointerdown',(e) => {
5540
+ if (e.which === 1) {
5541
+ mouseButtonDown = true;
5542
+ }
5543
+ e.preventDefault();
5544
+ });
5545
+ $(canvas).on('pointerup',(e) => {
5546
+ if (e.which === 1 && mouseButtonDown) {
5547
+ mouseButtonDown = false;
5548
+ $timeout(() => angular.element(canvas).triggerHandler('mouseup'));
5549
+ }
5550
+ });
5518
5551
 
5519
- $compile(element)(element.scope());
5520
5552
  }
5521
5553
  };
5522
- })
5554
+ })
5523
5555
 
5524
5556
  .directive('cronChat', ['$compile', '$translate', function($compile, $translate) {
5525
5557
  return {
@@ -307,17 +307,28 @@
307
307
  this.mergeParam = function(parameters, params) {
308
308
  var getValue = function(key, json) {
309
309
  for (var i in Object.keys(json)) {
310
- var k = Object.keys(json[i])[0];
311
- if (key == k)
312
- return Object.values(json[i])[0];
310
+ if (isJsonContent(json[i])) {
311
+ var k = Object.keys(json[i])[0];
312
+ if (key == k)
313
+ return Object.values(json[i])[0];
314
+ }
313
315
  }
314
316
  };
317
+ let isJsonContent = (content) => {
318
+ let jsonConstructor = ({}).constructor;
319
+ return (content && jsonConstructor === content.constructor);
320
+ };
321
+
315
322
  for (var i in Object.keys(parameters)) {
316
323
  var k = parameters[i].name;
317
324
  var v = parameters[i].value;
318
325
  var valueParam = getValue(k, params);
319
326
  if (valueParam) {
320
327
  parameters[i].value = valueParam;
328
+ } else {
329
+ if (Array.isArray(params) && !isJsonContent(params[i])) {
330
+ parameters[i].value = params[i];
331
+ }
321
332
  }
322
333
  }
323
334
  return parameters;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cronapp-framework-js",
3
- "version": "2.9.1-SP.2",
3
+ "version": "2.9.1-SP.20",
4
4
  "description": "Javascript library for CronApp's projects",
5
5
  "main": "cronapp.framework.js",
6
6
  "scripts": {