cronapp-framework-js 3.0.0-SP.3 → 3.0.0-SP.31

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 (93) hide show
  1. package/components/crn-dynamic-menu.components.json +0 -21
  2. package/components/crn-enterprise-combobox-multiple.components.json +6 -0
  3. package/components/crn-navbar.components.json +1 -1
  4. package/components/templates/Component_Container/crn-eight-four-container.template.html +2 -2
  5. package/components/templates/Component_Container/crn-four-eight-container.template.html +2 -2
  6. package/components/templates/Component_Container/crn-one-container.template.html +1 -1
  7. package/components/templates/Component_Container/crn-three-container.template.html +3 -3
  8. package/components/templates/Component_Container/crn-three-six-three-container.template.html +3 -3
  9. package/components/templates/Component_Container/crn-two-container.template.html +2 -2
  10. package/components/templates/cron-autocomplete.designtime.html +2 -2
  11. package/components/templates/cron-combobox-multiple.template.html +1 -1
  12. package/css/themes/custom/aquamarine/custom-aquamarine.css +1 -0
  13. package/css/themes/custom/cerulean/custom-cerulean.css +1 -0
  14. package/css/themes/custom/cosmo/custom-cosmo.css +1 -0
  15. package/css/themes/custom/cyborg/custom-cyborg.css +1 -0
  16. package/css/themes/custom/darkly/custom-darkly.css +1 -0
  17. package/css/themes/custom/dsgov/custom-dsgov.css +1 -0
  18. package/css/themes/custom/flatly/custom-flatly.css +1 -0
  19. package/css/themes/custom/fuse/custom-fuse.css +1 -0
  20. package/css/themes/custom/journal/custom-journal.css +1 -0
  21. package/css/themes/custom/krypton/custom-krypton.css +1024 -236
  22. package/css/themes/custom/krypton/grid-krypton.css +253 -66
  23. package/css/themes/custom/krypton/navbar-krypton.css +13 -12
  24. package/css/themes/custom/krypton/panel-krypton.css +29 -26
  25. package/css/themes/custom/lumen/custom-lumen.css +1 -0
  26. package/css/themes/custom/material/custom-material.css +1 -0
  27. package/css/themes/custom/material/navbar-material.css +2 -0
  28. package/css/themes/custom/material-round/custom-material-round.css +187 -34
  29. package/css/themes/custom/material-round/grid-material-round.css +174 -18
  30. package/css/themes/custom/materialui/custom-materialui.css +1 -0
  31. package/css/themes/custom/navigator/custom-navigator.css +80 -21
  32. package/css/themes/custom/paper/custom-paper.css +1 -0
  33. package/css/themes/custom/readable/custom-readable.css +1 -0
  34. package/css/themes/custom/sandstone/custom-sandstone.css +1 -0
  35. package/css/themes/custom/simplex/custom-simplex.css +1 -0
  36. package/css/themes/custom/slate/custom-slate.css +1 -0
  37. package/css/themes/custom/spacelab/custom-spacelab.css +1 -0
  38. package/css/themes/custom/superhero/custom-superhero.css +1 -0
  39. package/css/themes/custom/theme-general/menu-vertical-retratil.css +35 -22
  40. package/css/themes/custom/theme-general/menu.css +4 -0
  41. package/css/themes/custom/united/custom-united.css +1 -0
  42. package/css/themes/custom/yeti/custom-yeti.css +1 -0
  43. package/dist/components/templates/Component_Container/crn-eight-four-container.template.html +1 -1
  44. package/dist/components/templates/Component_Container/crn-four-eight-container.template.html +1 -1
  45. package/dist/components/templates/Component_Container/crn-one-container.template.html +1 -1
  46. package/dist/components/templates/Component_Container/crn-three-container.template.html +1 -1
  47. package/dist/components/templates/Component_Container/crn-three-six-three-container.template.html +1 -1
  48. package/dist/components/templates/Component_Container/crn-two-container.template.html +1 -1
  49. package/dist/components/templates/cron-autocomplete.designtime.html +1 -1
  50. package/dist/components/templates/cron-combobox-multiple.template.html +1 -1
  51. package/dist/css/themes/custom/aquamarine/custom-aquamarine.css +1 -1
  52. package/dist/css/themes/custom/cerulean/custom-cerulean.css +1 -1
  53. package/dist/css/themes/custom/cosmo/custom-cosmo.css +1 -1
  54. package/dist/css/themes/custom/cyborg/custom-cyborg.css +1 -1
  55. package/dist/css/themes/custom/darkly/custom-darkly.css +1 -1
  56. package/dist/css/themes/custom/dsgov/custom-dsgov.css +1 -1
  57. package/dist/css/themes/custom/flatly/custom-flatly.css +1 -1
  58. package/dist/css/themes/custom/fuse/custom-fuse.css +1 -1
  59. package/dist/css/themes/custom/journal/custom-journal.css +1 -1
  60. package/dist/css/themes/custom/krypton/custom-krypton.css +1 -1
  61. package/dist/css/themes/custom/krypton/grid-krypton.css +1 -1
  62. package/dist/css/themes/custom/krypton/navbar-krypton.css +1 -1
  63. package/dist/css/themes/custom/krypton/panel-krypton.css +1 -1
  64. package/dist/css/themes/custom/lumen/custom-lumen.css +1 -1
  65. package/dist/css/themes/custom/material/custom-material.css +1 -1
  66. package/dist/css/themes/custom/material/navbar-material.css +1 -1
  67. package/dist/css/themes/custom/material-round/custom-material-round.css +1 -1
  68. package/dist/css/themes/custom/material-round/grid-material-round.css +1 -1
  69. package/dist/css/themes/custom/materialui/custom-materialui.css +1 -1
  70. package/dist/css/themes/custom/navigator/custom-navigator.css +1 -1
  71. package/dist/css/themes/custom/paper/custom-paper.css +1 -1
  72. package/dist/css/themes/custom/readable/custom-readable.css +1 -1
  73. package/dist/css/themes/custom/sandstone/custom-sandstone.css +1 -1
  74. package/dist/css/themes/custom/simplex/custom-simplex.css +1 -1
  75. package/dist/css/themes/custom/slate/custom-slate.css +1 -1
  76. package/dist/css/themes/custom/spacelab/custom-spacelab.css +1 -1
  77. package/dist/css/themes/custom/superhero/custom-superhero.css +1 -1
  78. package/dist/css/themes/custom/theme-general/menu-vertical-retratil.css +1 -1
  79. package/dist/css/themes/custom/theme-general/menu.css +1 -1
  80. package/dist/css/themes/custom/united/custom-united.css +1 -1
  81. package/dist/css/themes/custom/yeti/custom-yeti.css +1 -1
  82. package/dist/js/app.js +1 -1
  83. package/dist/js/controllers.js +1 -1
  84. package/dist/js/directives.js +10 -10
  85. package/dist/js/reports/reports.service.js +1 -1
  86. package/dist/js/upload.service.js +1 -1
  87. package/js/app.js +5 -4
  88. package/js/controllers.js +42 -19
  89. package/js/directives.js +75 -14
  90. package/js/reports/reports.service.js +5 -5
  91. package/js/upload.service.js +7 -4
  92. package/package.json +1 -1
  93. package/postupdate.json +6 -0
@@ -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))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.getDatasourcesInBandDashBoard=function(a){var b={hasParam:!1,datasources:[]},c=Stimulsoft.Report.StiReport.createNewDashboard();return c.load(a),c.pages&&c.pages.list&&0<c.pages.list.length&&c.pages.toList().forEach(function(a){a.components.toList().forEach(function(a){var c=a.getDataSources()||[];c.forEach(function(a){var c=stimulsoftHelper.getParamsFromFilter(a),d=stimulsoftHelper.getQueryName(a);b.datasources.push({name:a.name,customId:d,fieldParams:c,queryParams:[]}),c.length&&(b.hasParam=!0)})})}),b},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){if(a&&a.data){var e=a.data.reportName.endsWith(".report"),f=a.data.reportName.endsWith(".dashboard");e||f?this.loadSriptsStimulsoft(function(e){e?(this.initializeStimulsoft(d.use()),this.getContentAsString(a.data).then(function(e){var g=this.getDatasourcesInBand(e.data);f&&(g=this.getDatasourcesInBandDashBoard(e.data)),this.getDataSourcesParams(g).then(function(f){g=f.data,a.data.parameters=stimulsoftHelper.parseToGroupedParam(g.datasources),a.data.contentData=e.data,a.data.datasourcesInBand=g,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:window.hostApp+"api/rest/report",method:"POST",data:angular.toJson({reportName:b})};return a(c)},this.getPDF=function(b){var c={url:window.hostApp+"api/rest/report/pdf",method:"POST",responseType:"arraybuffer",data:angular.toJson(b)};return a(c)},this.getPDFAsFile=function(b){var c={url:window.hostApp+"api/rest/report/pdfasfile",method:"POST",data:angular.toJson(b)};return a(c)},this.getContentAsString=function(b){var c={url:window.hostApp+"api/rest/report/contentasstring",method:"POST",data:angular.toJson(b)};return a(c)},this.getDataSourcesParams=function(b){var c={url:window.hostApp+"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.getDatasourcesInBandDashBoard=function(a){var b={hasParam:!1,datasources:[]},c=Stimulsoft.Report.StiReport.createNewDashboard();return c.load(a),c.pages&&c.pages.list&&0<c.pages.list.length&&c.pages.toList().forEach(function(a){a.components.toList().forEach(function(a){var c=a.getDataSources()||[];c.forEach(function(a){var c=stimulsoftHelper.getParamsFromFilter(a),d=stimulsoftHelper.getQueryName(a);b.datasources.push({name:a.name,customId:d,fieldParams:c,queryParams:[]}),c.length&&(b.hasParam=!0)})})}),b},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){if(a&&a.data){var e=a.data.reportName.endsWith(".report"),f=a.data.reportName.endsWith(".dashboard");e||f?this.loadSriptsStimulsoft(function(e){e?(this.initializeStimulsoft(d.use()),this.getContentAsString(a.data).then(function(e){var g=this.getDatasourcesInBand(e.data);f&&(g=this.getDatasourcesInBandDashBoard(e.data)),this.getDataSourcesParams(g).then(function(f){g=f.data,a.data.parameters=stimulsoftHelper.parseToGroupedParam(g.datasources),a.data.contentData=e.data,a.data.datasourcesInBand=g,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 +1 @@
1
- (function(){function a(a){var b=[].slice.call(arguments,1),c=0;return a.replace(/%s/g,function(){return b[c++]})}angular.module("upload.services",[]).service("UploadService",["$http","$compile","$modal","Upload",function(a,b,c){var d=$("body"),e=angular.element(d.get(0)).scope();this.ensureProps=a=>(a.filter&&(a.filter=a.filter.replace(/\s/g,"")),a),this.upload=function(a){let b=this.ensureProps(a);c.open({templateUrl:"node_modules/cronapp-framework-js/components/upload/upload.html",controller:"UploadController",resolve:{data:function(){return b}}})}.bind(this)}]),angular.module("custom.controllers").controller("UploadController",["$scope","$http","$translate","$stateParams","$location","$http","$modalInstance","data",function(b,c,d,e,f,c,g,h){app.registerEventsCronapi(b,d),b.params=e,b.$http=c;var i=f.search();for(var j in i)i.hasOwnProperty(j)&&(b.params[j]=i[j]);b.files=[],b.uploading=!1,b.uploaded=!0,b.progress=0,b.data=h,b.message=d.instant("Upload.oneFile"),"true"==h.multiple&&(b.message=d.instant("Upload.multipleFile")),h.description&&(b.message=h.description),b.safeApply=safeApply,b.uploadFile=function(e){var f=b.data.scope,g="api/cronapi/upload/"+h.id,j=new FormData;if(0==e.length)this.Notification.error(a(d.instant("Upload.errorValidation"),h.maxSize,h.filter));else{for(var k=0;k<e.length;k++)j.append("file",e[k]),console.log(e[k].$valid);var l=JSON.parse(localStorage.getItem("_u"));this.$promise=c({method:"POST",url:(window.hostApp||"")+g,data:j,headers:{"Content-Type":void 0,"X-AUTH-TOKEN":l?l.token:""},onProgress:function(a){this.safeApply(function(){if(a.lengthComputable){var c=0|100*(a.loaded/a.total);b.progress=c}b.uploading=!0,console.log(c)})}.bind(this)}).then(function(a){f.cronapi.evalInContext(JSON.stringify(a)).then(()=>{b.uploaded=!0,b.uploading=!1,b.close()})}.bind(this)).catch(function(a){let c=a.error;a&&a.data&&(c=a.data.error),this.Notification.error(c),b.uploading=!1,b.close()}.bind(this))}}.bind(b),b.close=function(){g.dismiss("cancel")}}])})(app);
1
+ (function(){function a(a){var b=[].slice.call(arguments,1),c=0;return a.replace(/%s/g,function(){return b[c++]})}angular.module("upload.services",[]).service("UploadService",["$http","$compile","$modal","Upload",function(a,b,c){var d=$("body"),e=angular.element(d.get(0)).scope();this.ensureProps=a=>(a.filter&&(a.filter=a.filter.replace(/\s/g,"")),a),this.upload=function(a){let b=this.ensureProps(a);c.open({templateUrl:"node_modules/cronapp-framework-js/components/upload/upload.html",controller:"UploadController",resolve:{data:function(){return b}}})}.bind(this)}]),angular.module("custom.controllers").controller("UploadController",["$scope","$http","$translate","$stateParams","$location","$http","$modalInstance","data",function(b,c,d,e,f,c,g,h){app.registerEventsCronapi(b,d),b.params=e,b.$http=c;var i=f.search();for(var j in i)i.hasOwnProperty(j)&&(b.params[j]=i[j]);b.files=[],b.uploading=!1,b.uploaded=!0,b.progress=0,b.data=h,b.message=d.instant("Upload.oneFile"),"true"==h.multiple&&(b.message=d.instant("Upload.multipleFile")),h.description&&(b.message=h.description),b.safeApply=safeApply,b.uploadFile=function(e){var f=b.data.scope,g="api/cronapi/upload/"+h.id,j=new FormData;if(0==e.length)this.Notification.error(a(d.instant("Upload.errorValidation"),h.maxSize,h.filter));else{for(var k=0;k<e.length;k++)j.append("file",e[k]),console.log(e[k].$valid);var l=JSON.parse(localStorage.getItem("_u"));let a=window.isUsingCookie()?{"Content-Type":void 0}:{"Content-Type":void 0,"X-AUTH-TOKEN":l?l.token:""};this.$promise=c({method:"POST",url:(window.hostApp||"")+g,data:j,headers:a,onProgress:function(a){this.safeApply(function(){if(a.lengthComputable){var c=0|100*(a.loaded/a.total);b.progress=c}b.uploading=!0,console.log(c)})}.bind(this)}).then(function(a){f.cronapi.evalInContext(JSON.stringify(a)).then(()=>{b.uploaded=!0,b.uploading=!1,b.close()})}.bind(this)).catch(function(a){let c=a.error;a&&a.data&&(c=a.data.error),this.Notification.error(c),b.uploading=!1,b.close()}.bind(this))}}.bind(b),b.close=function(){g.dismiss("cancel")}}])})(app);
package/js/app.js CHANGED
@@ -71,10 +71,11 @@ var app = (function() {
71
71
  function($q, $rootScope) {
72
72
  var service = {
73
73
  'request': function(config) {
74
- var _u = JSON.parse(localStorage.getItem('_u'));
75
- if (_u && _u.token) {
76
- config.headers['X-AUTH-TOKEN'] = _u.token;
77
- window.uToken = _u.token;
74
+ if (!window.isUsingCookie()) {
75
+ var _u = JSON.parse(localStorage.getItem('_u'));
76
+ if (_u && _u.token) {
77
+ config.headers['X-AUTH-TOKEN'] = _u.token;
78
+ }
78
79
  }
79
80
  return config;
80
81
  }
package/js/controllers.js CHANGED
@@ -1,3 +1,6 @@
1
+ if (!window.hostApp) {
2
+ window.hostApp = "";
3
+ }
1
4
  (function($app) {
2
5
  angular.module('custom.controllers', []);
3
6
 
@@ -5,9 +8,12 @@
5
8
  var refreshToken = function ($http, success, error) {
6
9
  $http({
7
10
  method: 'GET',
8
- url: 'auth/refresh'
11
+ url: window.hostApp + 'auth/refresh'
9
12
  }).then(function (data, status, headers, config) {
10
13
  data = getRequestData(data);
14
+ if (window.isUsingCookie()) {
15
+ delete data.token;
16
+ }
11
17
  //Keeping the user information, the auth/refresh only has name and username info
12
18
  if (localStorage.getItem("_u")) {
13
19
  let currentSession = JSON.parse(localStorage.getItem("_u"));
@@ -44,14 +50,17 @@
44
50
  return;
45
51
  }
46
52
 
53
+ let headerValues = window.isUsingCookie() ? {
54
+ 'Content-Type': 'application/x-www-form-urlencoded'
55
+ } : {
56
+ 'Content-Type': 'application/x-www-form-urlencoded',
57
+ 'X-AUTH-TOKEN' : $location.search().token
58
+ };
47
59
  $http({
48
60
  method: 'POST',
49
- url: 'auth/confirm-reset-password',
61
+ url: window.hostApp + 'auth/confirm-reset-password',
50
62
  data: $.param({password: passwordNew.value}),
51
- headers: {
52
- 'Content-Type': 'application/x-www-form-urlencoded',
53
- 'X-AUTH-TOKEN': $location.search().token
54
- }
63
+ headers: headerValues
55
64
  }).then(() => {
56
65
  Notification.info($translate.instant('ResetPasswordSuccess'));
57
66
  passwordNew.value = "";
@@ -71,6 +80,8 @@
71
80
 
72
81
  app.registerEventsCronapi($scope, $translate);
73
82
 
83
+ $rootScope.Notification = Notification; // Não remover, usado pelo cronapi.js para notificar erros de auto-cadastro.
84
+
74
85
  $scope.cronapi.screen.changeValueOfField('vars.signupEmail','');
75
86
  $scope.cronapi.screen.changeValueOfField('vars.signupUsername','');
76
87
  $scope.cronapi.screen.changeValueOfField('vars.signupPassword','');
@@ -131,6 +142,9 @@
131
142
  if ($cookies.get('_u')) {
132
143
  if (!localStorage.getItem('_u')) {
133
144
  var decodedUser = decodeURIComponent($cookies.get('_u'));
145
+ if (window.isUsingCookie()) {
146
+ delete decodedUser.token;
147
+ }
134
148
  localStorage.setItem("_u", decodedUser);
135
149
  }
136
150
  $scope.goHome();
@@ -166,13 +180,12 @@
166
180
  'Content-Type' : 'application/x-www-form-urlencoded'
167
181
  };
168
182
 
169
- if (token) {
170
- headerValues["X-AUTH-TOKEN"] = token;
171
- }
183
+ // Necessario para concluir a autenticação via SSO. Neste momento ainda não existe o cookie
184
+ headerValues["X-AUTH-TOKEN"] = token;
172
185
 
173
186
  $http({
174
187
  method : 'POST',
175
- url : 'auth',
188
+ url : window.hostApp + 'auth',
176
189
  data : $.param(user),
177
190
  headers : headerValues
178
191
  }).then(handleSuccess).catch(handleError);
@@ -191,7 +204,7 @@
191
204
 
192
205
  $http({
193
206
  method: 'POST',
194
- url: 'auth/reset-password',
207
+ url: window.hostApp + 'auth/reset-password',
195
208
  data: $.param({email: forgotPasswordEmail.value}),
196
209
  headers: {
197
210
  'Content-Type': 'application/x-www-form-urlencoded'
@@ -209,6 +222,9 @@
209
222
  // The local storage will be cleaned when the browser window is closed
210
223
  if(typeof (Storage) !== "undefined") {
211
224
  // save the user data on localStorage
225
+ if (window.isUsingCookie()) {
226
+ delete data.token;
227
+ }
212
228
  localStorage.setItem("_u", JSON.stringify(data));
213
229
  $rootScope.session = JSON.parse(localStorage._u);
214
230
  }
@@ -232,8 +248,12 @@
232
248
  data = getRequestData(data);
233
249
  let error;
234
250
  if (data !== null && data.message) {
235
- let message = JSON.parse(data.message);
236
- error = message.exception
251
+ if (typeof data.message !== 'string') {
252
+ let message = JSON.parse(data.message);
253
+ error = message.exception;
254
+ } else {
255
+ error = data.message;
256
+ }
237
257
  } else if (typeof data === 'string' && status !== 502) {
238
258
  error = data;
239
259
  if (!error && status === 401) {
@@ -352,15 +372,15 @@
352
372
  $('#themeSytleSheet').attr('href', "node_modules/cronapp-framework-js/css/themes/" + value + ".min.css");
353
373
  }
354
374
  });
355
- if(localStorage.getItem('_u') && JSON.parse(localStorage.getItem('_u')).token){
356
- refreshToken($http,function(){},function(){
375
+ if (localStorage.getItem('_u') && (JSON.parse(localStorage.getItem('_u')).token || window.isUsingCookie())){
376
+ refreshToken($http, function() {},function() {
357
377
  localStorage.removeItem('_u');
358
378
  if (window.location.hash) {
359
379
  $state.go('loginReturnUrl', { "returnUrl" : window.location.hash });
360
380
  } else {
361
381
  $state.go('login');
362
382
  }
363
- })
383
+ });
364
384
  }
365
385
  }
366
386
  else {
@@ -377,7 +397,7 @@
377
397
  $rootScope.logout = function logout() {
378
398
  $http({
379
399
  method : 'GET',
380
- url : 'logout',
400
+ url : window.hostApp + 'logout',
381
401
  headers : {
382
402
  'Content-Type' : 'application/json'
383
403
  }
@@ -409,7 +429,7 @@
409
429
 
410
430
  $http({
411
431
  method : 'POST',
412
- url : 'changePassword',
432
+ url : window.hostApp + 'changePassword',
413
433
  data : $.param(user),
414
434
  headers : {
415
435
  'Content-Type' : 'application/x-www-form-urlencoded'
@@ -507,7 +527,7 @@
507
527
 
508
528
  $http({
509
529
  method : 'POST',
510
- url : 'changeTheme',
530
+ url : window.hostApp + 'changeTheme',
511
531
  data : $.param(user),
512
532
  headers : {
513
533
  'Content-Type' : 'application/x-www-form-urlencoded'
@@ -517,6 +537,9 @@
517
537
  function changeSuccess(data, status, headers, config) {
518
538
  $rootScope.session.theme = theme;
519
539
  $rootScope.session.user.theme = theme;
540
+ if (window.isUsingCookie()) {
541
+ delete $rootScope.session.token;
542
+ }
520
543
  localStorage.setItem("_u", JSON.stringify($rootScope.session));
521
544
  }
522
545
 
package/js/directives.js CHANGED
@@ -2837,9 +2837,7 @@
2837
2837
  'selectedRows': selectedRowsKeyOrObj
2838
2838
  };
2839
2839
 
2840
- if (this.element.find('input[type=checkbox]').length === 0) {
2841
- cronappDatasource.goTo(itemAsObj);
2842
- }
2840
+ cronappDatasource.goTo(itemAsObj);
2843
2841
  scope.$eval(call, contextVars);
2844
2842
  return;
2845
2843
  }
@@ -2989,7 +2987,11 @@
2989
2987
  var cronappDatasource = this.dataSource.transport.options.cronappDatasource;
2990
2988
  if (!(cronappDatasource.inserting || cronappDatasource.editing)) {
2991
2989
  if (this.selectable) {
2990
+ setToActiveInCronappDataSource.bind(this)(e.data);
2992
2991
  this.select(e.masterRow);
2992
+ if (options.columns.find(c => c.dataType == 'Selectable') !== undefined) {
2993
+ collapseAllExcecptCurrent(this, e.detailRow, e.masterRow);
2994
+ }
2993
2995
  }
2994
2996
  else {
2995
2997
  setToActiveInCronappDataSource.bind(this)(e.data);
@@ -3217,14 +3219,22 @@
3217
3219
  },
3218
3220
  change: function(e) {
3219
3221
  var item = this.dataItem(this.select());
3220
- setToActiveInCronappDataSource.bind(this)(item);
3222
+ if ((options.details && options.details.length == 0) || (!cronapi.internal.hasMethodInCallStack('detailInit'))) {
3223
+ setToActiveInCronappDataSource.bind(this)(item);
3224
+ }
3221
3225
  var cronappDatasource = this.dataSource.transport.options.cronappDatasource;
3222
3226
  if(options.fieldType && options.fieldType === 'key'){
3223
3227
  cronappDatasource.active = helperDirective.changeObjectField(cronappDatasource, cronappDatasource.active);
3224
3228
  }
3229
+
3230
+ let trDetails = this.select().next();
3231
+ let trMasters = this.select();
3232
+
3225
3233
  if (ngModelCtrl) {
3226
3234
  if ("multiple" === options.allowSelectionRowType) {
3227
3235
  let selecteds = [];
3236
+ trDetails = [];
3237
+ trMasters = [];
3228
3238
  this.select().each((i, row)=> {
3229
3239
  let item = this.dataItem(row);
3230
3240
  let objInDs = cronappDatasource.findObjInDs(item, false);
@@ -3234,6 +3244,10 @@
3234
3244
  if (objInDs !== null){
3235
3245
  selecteds.push(objInDs);
3236
3246
  }
3247
+ if (item["_objectKey"] === cronappDatasource.active["_objectKey"]) {
3248
+ trMasters.push(this.select()[i]);
3249
+ trDetails.push(this.select().next()[i]);
3250
+ }
3237
3251
  });
3238
3252
  ngModelCtrl.$setViewValue(selecteds);
3239
3253
  }
@@ -3246,7 +3260,7 @@
3246
3260
  }
3247
3261
  }
3248
3262
  }
3249
- collapseAllExcecptCurrent(this, this.select().next(), this.select());
3263
+ collapseAllExcecptCurrent(this, trDetails, trMasters);
3250
3264
 
3251
3265
  if (attrs && attrs.ngChange) {
3252
3266
  scope.$eval(attrs.ngChange);
@@ -3269,8 +3283,8 @@
3269
3283
  command = 'edit';
3270
3284
  }
3271
3285
 
3272
- let modelName = helperDirective.getModelName(attrs);
3273
- if (item && item["_objectKey"]) {
3286
+ let modelName = helperDirective.getModelName(attrs);
3287
+ if (item && item["_objectKey"]) {
3274
3288
  let key = item["_objectKey"];
3275
3289
  let id = `${modelName}-${command}-${key}`;
3276
3290
  $elem.attr('id', id);
@@ -3531,8 +3545,8 @@
3531
3545
  getAllParent(cronappDatasource, itemResult.d.results[0], ids, resolve, reject);
3532
3546
  },
3533
3547
  beforeSend: (xhr) => {
3534
- if (window.uToken) {
3535
- xhr.setRequestHeader ("X-AUTH-TOKEN", window.uToken);
3548
+ if (!window.isUsingCookie()) {
3549
+ xhr.setRequestHeader ("X-AUTH-TOKEN", cronapi.util.getUserToken());
3536
3550
  }
3537
3551
  },
3538
3552
  error: () => reject(),
@@ -3673,8 +3687,8 @@
3673
3687
  resolve();
3674
3688
  },
3675
3689
  beforeSend: (xhr) => {
3676
- if (window.uToken) {
3677
- xhr.setRequestHeader ("X-AUTH-TOKEN", window.uToken);
3690
+ if (!window.isUsingCookie()) {
3691
+ xhr.setRequestHeader ("X-AUTH-TOKEN", cronapi.util.getUserToken());
3678
3692
  }
3679
3693
  },
3680
3694
  error: () => reject(),
@@ -4175,9 +4189,10 @@
4175
4189
  options.dataBound = attrs.ngDataBound ? function (){scope.$eval(attrs.ngDataBound)}: undefined;
4176
4190
  options.filtering = attrs.ngFiltering ? function (){scope.$eval(attrs.ngFiltering)}: undefined;
4177
4191
  options.open = function(e) {
4178
- if (!dataSourceScreen.fetched || (dataSourceScreen.data.length > combobox.dataSource.data().length)) {
4192
+ if (!dataSourceScreen.fetched || (dataSourceScreen.lastLoadedTime !== combobox.dataSource.lastLoadedTime)) {
4179
4193
  combobox.options.firstLazyRead = true;
4180
4194
  combobox.dataSource.read();
4195
+ combobox.dataSource.lastLoadedTime = dataSourceScreen.lastLoadedTime;
4181
4196
  }
4182
4197
  };
4183
4198
 
@@ -4225,6 +4240,13 @@
4225
4240
 
4226
4241
  this.toComboType(attrs, parent, select, combobox);
4227
4242
 
4243
+ let forcedRefreshModelAt;
4244
+ let canRefresh = () => {
4245
+ let check = performance.now();
4246
+ if (!forcedRefreshModelAt) return true;
4247
+ return check - forcedRefreshModelAt > 2000;
4248
+ };
4249
+
4228
4250
  var forceChangeModel = async function(value) {
4229
4251
 
4230
4252
  $log.debug("forceChangeModel | " + attrs['id'] + " | " + value);
@@ -4331,7 +4353,7 @@
4331
4353
  overRideRefresh: function() {
4332
4354
  dataSourceScreen.fetched = false;
4333
4355
  dataSourceScreen.cleanup();
4334
- defineInitialValue();
4356
+ canRefresh() && defineInitialValue();
4335
4357
  }
4336
4358
  });
4337
4359
  }
@@ -4465,6 +4487,10 @@
4465
4487
  });
4466
4488
 
4467
4489
  $("[aria-owns='" + `${attrs.id}_listbox` + "']").attr('aria-label', $translate.instant('template.crud.search'));
4490
+ if (ngModelCtrl.$modelValue) {
4491
+ _scope.cronapi.internal.forceRefreshNgModel(attrs.ngModel, ngModelCtrl.$modelValue);
4492
+ forcedRefreshModelAt = performance.now();
4493
+ }
4468
4494
  }
4469
4495
  };
4470
4496
  })
@@ -5262,6 +5288,14 @@
5262
5288
  return false;
5263
5289
  });
5264
5290
  }
5291
+ $('#checkCollapsibleMenu').on('click', function() {
5292
+ var mainView = document.getElementById("main-view");
5293
+ if (this.checked) {
5294
+ mainView.classList.remove("main-view-retratil");
5295
+ } else {
5296
+ mainView.classList.add("main-view-retratil");
5297
+ }
5298
+ });
5265
5299
  });
5266
5300
  });
5267
5301
  }
@@ -7258,6 +7292,33 @@ function cronReportViewer($compile) {
7258
7292
 
7259
7293
  executeReport(attrs.options);
7260
7294
 
7295
+ // Não inicia em em Tab não ativa
7296
+ // Verifica se esta dentro de um tab
7297
+ let elementTab = element[0].parentElement;
7298
+ while (elementTab) {
7299
+ if (elementTab.tagName === "BODY") {
7300
+ elementTab = null;
7301
+ } else if (elementTab.classList.contains("tab-pane")) {
7302
+ break;
7303
+ } else {
7304
+ elementTab = elementTab.parentElement;
7305
+ }
7306
+ }
7307
+ // Se estiver dentro de um tab e esta não estiver ativa, inclui observador para ler o relatorio ao ativar a tab
7308
+ if (elementTab && !elementTab.classList.contains("active")) {
7309
+ let observerClassChange = new MutationObserver(function(mutationsList, observer) {
7310
+ for (let mutation of mutationsList) {
7311
+ if (mutation.attributeName === "class" && mutation.target.classList.contains("active")) {
7312
+ executeReport(attrs.options);
7313
+ // Desconecta observador, pois só precisa ser executado uma vez.
7314
+ observer.disconnect();
7315
+ break;
7316
+ }
7317
+ }
7318
+ });
7319
+ observerClassChange.observe(elementTab, { attributes: true });
7320
+ }
7321
+
7261
7322
  var filterTimeout = null;
7262
7323
  scope.$watch(function(){ return attrs.options }, function(value, old){
7263
7324
  if (value !== old) {
@@ -7276,4 +7337,4 @@ function cronReportViewer($compile) {
7276
7337
 
7277
7338
  }
7278
7339
  };
7279
- }
7340
+ }
@@ -14,7 +14,7 @@
14
14
  // data
15
15
  this.getReport = function(reportName) {
16
16
  var req = {
17
- url : 'api/rest/report',
17
+ url : window.hostApp + 'api/rest/report',
18
18
  method : 'POST',
19
19
  data : angular.toJson({
20
20
  'reportName' : reportName
@@ -26,7 +26,7 @@
26
26
  // bytes[]
27
27
  this.getPDF = function(report) {
28
28
  var req = {
29
- url : 'api/rest/report/pdf',
29
+ url : window.hostApp + 'api/rest/report/pdf',
30
30
  method : 'POST',
31
31
  responseType : 'arraybuffer',
32
32
  data : angular.toJson(report)
@@ -37,7 +37,7 @@
37
37
  // file
38
38
  this.getPDFAsFile = function(report) {
39
39
  var req = {
40
- url : 'api/rest/report/pdfasfile',
40
+ url : window.hostApp + 'api/rest/report/pdfasfile',
41
41
  method : 'POST',
42
42
  data : angular.toJson(report)
43
43
  };
@@ -46,7 +46,7 @@
46
46
 
47
47
  this.getContentAsString = function(report) {
48
48
  var req = {
49
- url : 'api/rest/report/contentasstring',
49
+ url : window.hostApp + 'api/rest/report/contentasstring',
50
50
  method : 'POST',
51
51
  data : angular.toJson(report)
52
52
  };
@@ -55,7 +55,7 @@
55
55
 
56
56
  this.getDataSourcesParams = function(datasourcesInBand) {
57
57
  var req = {
58
- url : 'api/rest/report/getdatasourcesparams',
58
+ url : window.hostApp + 'api/rest/report/getdatasourcesparams',
59
59
  method : 'POST',
60
60
  data : angular.toJson(datasourcesInBand)
61
61
  };
@@ -80,14 +80,17 @@
80
80
  console.log(files[i].$valid);
81
81
  }
82
82
  var _u = JSON.parse(localStorage.getItem('_u'));
83
+ let headerValues = window.isUsingCookie() ? {
84
+ 'Content-Type' : undefined
85
+ } : {
86
+ 'Content-Type' : undefined,
87
+ 'X-AUTH-TOKEN' : (_u ?_u.token : '')
88
+ };
83
89
  this.$promise = $http({
84
90
  method: 'POST',
85
91
  url: (window.hostApp || "") + uploadUrl,
86
92
  data: formData,
87
- headers: {
88
- 'Content-Type': undefined,
89
- 'X-AUTH-TOKEN': (_u ?_u.token : '')
90
- },
93
+ headers: headerValues,
91
94
  onProgress: function(event) {
92
95
  this.safeApply(function() {
93
96
  if (event.lengthComputable) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cronapp-framework-js",
3
- "version": "3.0.0-SP.3",
3
+ "version": "3.0.0-SP.31",
4
4
  "description": "Javascript library for CronApp's projects",
5
5
  "main": "cronapp.framework.js",
6
6
  "scripts": {
package/postupdate.json CHANGED
@@ -20,6 +20,12 @@
20
20
  "type": "script",
21
21
  "onTop": true
22
22
  },
23
+ {
24
+ "file": "index.html",
25
+ "script": "js/hostApp.js",
26
+ "type": "script",
27
+ "onTop": true
28
+ },
23
29
  {
24
30
  "file": "index.html",
25
31
  "script": "js/customStateProvider.js",