cronapp-framework-js 3.2.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/crn-anchor.components.json +5 -0
- package/components/crn-button.components.json +5 -0
- package/components/crn-datepicker.components.json +5 -0
- package/components/crn-datetimepicker.components.json +5 -0
- package/components/crn-enterprise-autocomplete.components.json +5 -0
- package/components/crn-enterprise-checkbox.components.json +5 -0
- package/components/crn-enterprise-combobox-multiple.components.json +5 -0
- package/components/crn-enterprise-dynamic-autocomplete.components.json +5 -0
- package/components/crn-enterprise-dynamic-combobox.components.json +5 -0
- package/components/crn-icon.components.json +5 -0
- package/components/crn-image.components.json +5 -0
- package/components/crn-input-password.components.json +5 -0
- package/components/crn-rating.components.json +5 -0
- package/components/crn-simple-text.components.json +5 -0
- package/components/crn-slider.components.json +5 -0
- package/components/crn-text-component.components.json +5 -0
- package/components/crn-textarea.components.json +5 -0
- package/components/crn-textinput.components.json +5 -0
- package/components/crn-wizard.components.json +134 -0
- package/components/templates/anchor.template.html +1 -1
- package/components/templates/social-button-bar.template.html +6 -6
- package/components/templates/wizard.template.html +65 -0
- package/css/themes/custom/cerulean/custom-cerulean.css +30 -1
- package/css/themes/custom/cosmo/custom-cosmo.css +43 -1
- package/css/themes/custom/cyborg/custom-cyborg.css +43 -1
- package/css/themes/custom/darkly/custom-darkly.css +43 -1
- package/css/themes/custom/dsgov/custom-dsgov.css +27 -1
- package/css/themes/custom/flatly/custom-flatly.css +43 -1
- package/css/themes/custom/fuse/custom-fuse.css +30 -1
- package/css/themes/custom/journal/custom-journal.css +43 -1
- package/css/themes/custom/lumen/custom-lumen.css +43 -1
- package/css/themes/custom/material/custom-material.css +36 -1
- package/css/themes/custom/paper/custom-paper.css +43 -1
- package/css/themes/custom/readable/custom-readable.css +43 -1
- package/css/themes/custom/sandstone/custom-sandstone.css +43 -1
- package/css/themes/custom/simplex/custom-simplex.css +42 -1
- package/css/themes/custom/slate/custom-slate.css +43 -1
- package/css/themes/custom/spacelab/custom-spacelab.css +43 -1
- package/css/themes/custom/superhero/custom-superhero.css +42 -1
- package/css/themes/custom/theme-general/notification.css +1 -0
- package/css/themes/custom/theme-general/theme-general.css +92 -0
- package/css/themes/custom/theme-general/wizard.css +98 -0
- package/css/themes/custom/united/custom-united.css +37 -1
- package/css/themes/custom/yeti/custom-yeti.css +42 -1
- package/css/themes/theme.editor.view.html +6 -6
- package/dist/components/reports/BOOLEAN.parameter.html +1 -1
- package/dist/components/reports/DATE.parameter.html +1 -1
- package/dist/components/reports/DOUBLE.parameter.html +1 -1
- package/dist/components/reports/FLOAT.parameter.html +1 -1
- package/dist/components/reports/INTEGER.parameter.html +1 -1
- package/dist/components/reports/LONG.parameter.html +1 -1
- package/dist/components/reports/STRING.parameter.html +1 -1
- package/dist/components/reports/reports.view.html +1 -1
- package/dist/components/templates/anchor.template.html +1 -1
- package/dist/components/templates/carousel.template.html +1 -1
- package/dist/components/templates/crn-carousel-item.tempate.html +1 -1
- package/dist/components/templates/crn-signature-pad.designtime.html +1 -1
- package/dist/components/templates/crn-unordered-list.template.html +1 -1
- package/dist/components/templates/crn-unordered-sub-list.template.html +1 -1
- package/dist/components/templates/cron-autocomplete.designtime.html +1 -1
- package/dist/components/templates/cron-captcha.designtime.html +1 -1
- package/dist/components/templates/cron-checkbox.template.html +1 -1
- package/dist/components/templates/cron-combobox.designtime.html +1 -1
- package/dist/components/templates/cron-crud.template.html +1 -1
- package/dist/components/templates/cron-dashboard-viewer.designtime.html +1 -1
- package/dist/components/templates/cron-dynamic-combobox.designtime.html +1 -1
- package/dist/components/templates/cron-frame.designtime.html +1 -1
- package/dist/components/templates/cron-grid.designtime.html +1 -1
- package/dist/components/templates/cron-radio.template.html +1 -1
- package/dist/components/templates/cron-report-viewer.designtime.html +1 -1
- package/dist/components/templates/cron-scheduler.designtime.html +1 -1
- package/dist/components/templates/cron-slider.designtime.html +1 -1
- package/dist/components/templates/cron-tree-view.designtime.html +1 -1
- package/dist/components/templates/datasourcefilter.template.html +1 -1
- package/dist/components/templates/datasourcefiltercomplex.template.html +1 -1
- package/dist/components/templates/date.template.html +1 -1
- package/dist/components/templates/datetime.template.html +1 -1
- package/dist/components/templates/dynamicfile.designtime.html +1 -1
- package/dist/components/templates/dynamicimage.designtime.html +2 -2
- package/dist/components/templates/fileupload-button.template.html +1 -1
- package/dist/components/templates/fileupload.template.html +1 -1
- package/dist/components/templates/form.template.html +1 -1
- package/dist/components/templates/image.default.template.html +1 -1
- package/dist/components/templates/image.template.html +1 -1
- package/dist/components/templates/radiogroup.template.html +1 -1
- package/dist/components/templates/social-button-bar.template.html +1 -1
- package/dist/components/templates/sub-form.template.html +1 -1
- package/dist/components/templates/textarea.template.html +1 -1
- package/dist/components/templates/textinput.template.html +1 -1
- package/dist/components/templates/textinputbutton.template.html +1 -1
- package/dist/components/templates/time.template.html +1 -1
- package/dist/components/templates/treeview.template.html +1 -1
- package/dist/components/templates/wizard.template.html +1 -0
- package/dist/css/themes/custom/cerulean/custom-cerulean.css +1 -1
- package/dist/css/themes/custom/cosmo/custom-cosmo.css +1 -1
- package/dist/css/themes/custom/cyborg/custom-cyborg.css +1 -1
- package/dist/css/themes/custom/darkly/custom-darkly.css +1 -1
- package/dist/css/themes/custom/dsgov/custom-dsgov.css +1 -1
- package/dist/css/themes/custom/flatly/custom-flatly.css +1 -1
- package/dist/css/themes/custom/fuse/custom-fuse.css +1 -1
- package/dist/css/themes/custom/journal/custom-journal.css +1 -1
- package/dist/css/themes/custom/lumen/custom-lumen.css +1 -1
- package/dist/css/themes/custom/material/custom-material.css +1 -1
- package/dist/css/themes/custom/paper/custom-paper.css +1 -1
- package/dist/css/themes/custom/readable/custom-readable.css +1 -1
- package/dist/css/themes/custom/sandstone/custom-sandstone.css +1 -1
- package/dist/css/themes/custom/simplex/custom-simplex.css +1 -1
- package/dist/css/themes/custom/slate/custom-slate.css +1 -1
- package/dist/css/themes/custom/spacelab/custom-spacelab.css +1 -1
- package/dist/css/themes/custom/superhero/custom-superhero.css +1 -1
- package/dist/css/themes/custom/theme-general/notification.css +1 -1
- package/dist/css/themes/custom/theme-general/theme-general.css +1 -1
- package/dist/css/themes/custom/theme-general/wizard.css +1 -0
- package/dist/css/themes/custom/united/custom-united.css +1 -1
- package/dist/css/themes/custom/yeti/custom-yeti.css +1 -1
- package/dist/css/themes/theme.editor.view.html +1 -1
- package/dist/js/LanguageSelectDirective.js +1 -1
- package/dist/js/LocaleService.js +1 -1
- package/dist/js/app.js +1 -1
- package/dist/js/controllers.js +1 -1
- package/dist/js/custom.controllers.js +1 -1
- package/dist/js/customStateProvider.js +86 -0
- package/dist/js/dashboard/dashboard.service.js +1 -1
- package/dist/js/directives.js +1 -55
- package/dist/js/filters.js +1 -1
- package/dist/js/local-dateformat.directive.js +1 -1
- package/dist/js/reports/parameters.controller.js +1 -1
- package/dist/js/reports/reports.service.js +1 -1
- package/dist/js/services.js +1 -1
- package/dist/js/stateProvider.js +1 -1
- package/dist/js/upload.service.js +1 -1
- package/gulpfile.js +21 -35
- package/img/cron-icon/crn-wizard.svg +8 -0
- package/js/app.js +6 -21
- package/js/controllers.js +41 -57
- package/js/directives.js +72 -29
- package/package.json +17 -50
- package/postupdate.json +154 -38
- package/dist/img/cron-icon/crn-component.svg +0 -1
- package/dist/img/cron-icon/crn-infinite-scroll.svg +0 -1
package/dist/js/filters.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
!function(e){e.filter("tel",(function(){return function(e){var r=e+"";return r=11===(r=r.replace(/\D/g,"")).length?r.replace(/^(\d{2})(\d{5})(\d{4})/,"($1) $2-$3"):r.replace(/^(\d{2})(\d{4})(\d{4})/,"($1) $2-$3")}})),e.filter("cep",(function(){return function(e){var r=e+"";return r=(r=r.replace(/\D/g,"")).replace(/^(\d{2})(\d{3})(\d)/,"$1.$2-$3")}})),e.filter("cnpj",(function(){return function(e){var r=e+"";return r=(r=(r=(r=(r=r.replace(/\D/g,"")).replace(/^(\d{2})(\d)/,"$1.$2")).replace(/^(\d{2})\.(\d{3})(\d)/,"$1.$2.$3")).replace(/\.(\d{3})(\d)/,".$1/$2")).replace(/(\d{4})(\d)/,"$1-$2")}})),e.filter("encodeURIComponent",(function(){return function(e){return encodeURIComponent(e)}})),e.filter("renderHTML",["$sce",function(e){return e.trustAsHtml}])}(app);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
angular.module("MyApp").directive("dateFormat",function(){return{require:"ngModel",link:function(
|
|
1
|
+
angular.module("MyApp").directive("dateFormat",(function(){return{require:"ngModel",link:function(n,e,r,t){t.$formatters.push((function(n){return n?new Date(n):null}))}}}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
!function(){"use strict";function e(e,t,r,n,o){t.getDescription=function(e){var t=e.name;return e.description&&(t=e.description).indexOf("{{")>-1&&t.indexOf("}}")>-1&&(t=t.replace("{{","").replace("}}",""),t=window.cronapi.i18n.translate(t,[])),t},t.cloneElement=function(e){return angular.copy(e)},t.isVisibleParam=function(e){return"DATA_LIMIT"!=e.name&&(""===e.value||""==e.value)};var i=n.reportName.match(/\/(.*?)(.*?)(\.jrxml|\.report|.dashboard)/);function a(e){r.openURLContent(e.data)}t.report=n,t.report.name=i[2],t.htmlParameters=o,t.onPrint=function(){t.report.reportName.endsWith(".report")||t.report.reportName.endsWith(".dashboard")?r.openStimulsoftReport(t.report.contentData,t.report.parameters,t.report.datasourcesInBand):r.getPDFAsFile(t.report).then(a)},t.onCancel=function(){e.dismiss("cancel")}}angular.module("custom.controllers").controller("ParameterController",e).filter("trusted",["$sce",function(e){return function(t){return e.trustAsHtml(t)}}]).directive("compile",["$compile","$timeout",function(e,t){return{restrict:"A",link:function(r,n){t((function(){e(n.contents())(r)}))}}}]).directive("formatDate",(function(){return{require:"ngModel",link:function(e,t,r,n){n.$formatters.push((function(e){return e?new Date(e):null}))}}})),e.$inject=["$modalInstance","$scope","ReportService","report","htmlParameters"]}();
|
|
@@ -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: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
|
+
app,angular.module("report.services",[]).service("ReportService",["$http","$compile","$modal","$translate","$window","$rootScope",function(t,e,a,r,o,n){var i=$("body"),s=angular.element(i.get(0)).scope(),p=["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=[];function c(){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 d(t){window.open(t,"_blank")}this.getReport=function(e){var a={url:window.hostApp+"api/rest/report",method:"POST",data:angular.toJson({reportName:e})};return t(a)},this.getPDF=function(e){var a={url:window.hostApp+"api/rest/report/pdf",method:"POST",responseType:"arraybuffer",data:angular.toJson(e)};return t(a)},this.getPDFAsFile=function(e){var a={url:window.hostApp+"api/rest/report/pdfasfile",method:"POST",data:angular.toJson(e)};return t(a)},this.getContentAsString=function(e){var a={url:window.hostApp+"api/rest/report/contentasstring",method:"POST",data:angular.toJson(e)};return t(a)},this.getDataSourcesParams=function(e){var a={url:window.hostApp+"api/rest/report/getdatasourcesparams",method:"POST",data:angular.toJson(e)};return t(a)},this.openURLContent=function(t){if(t&&c())d(t);else{var a=$("#reportViewContext");a.get(0)||(console.log("include[#reportViewContext]"),i.append('<div id="reportViewContext" ng-include="\'node_modules/cronapp-framework-js/components/reports/reports.view.html\'"></div>'),e(i)(s),a=$("#reportViewContext"));var r=function(){var e=$("<iframe/>");e.attr("frameborder",0);var o=parseInt($(window).height());e.attr("height",o-200),e.attr("width","100%"),e.attr("src",t+"?download=false");var n=$("#reportView .modal-body");n.get(0)?(n.html(e),$("#reportViewContext .modal-dialog").css("width","95%"),setTimeout((function(){console.log("open[#reportViewContext]"),$("body").append(a),$("#reportView").modal()}),100)):(console.log("wait[#reportViewContext]"),setTimeout(r,200))};setTimeout(r,200)}},this.initializeStimulsoft=function(t){if(!Stimulsoft.Base.StiLicense.Key){stimulsoftHelper.setLanguage(t);var e=stimulsoftHelper.getLocalization();Stimulsoft.Base.Localization.StiLocalization.loadLocalization(e.xml),Stimulsoft.Base.Localization.StiLocalization.cultureName=e.cultureName,Stimulsoft.Base.StiLicense.Key=stimulsoftHelper.getKey()}},this.openStimulsoftReport=function(t,a,r,o){var p=$("#reportViewContext");p.get(0)||(i.append('<div id="reportViewContext" ng-include="\'node_modules/cronapp-framework-js/components/reports/reports.view.html\'"></div>'),e(i)(s),p=$("#reportViewContext"));var l=parseInt($(window).height())-200+"px",u="StiViewer"+app.common.generateId(),m=new Stimulsoft.Report.StiReport;n.reportTitle=t.ReportAlias,m.load(t),r||(r=stimulsoftHelper.getDatasourcesInBand(m)),a&&a.forEach((function(t){r.datasources.forEach((function(e){for(var a=0;a<e.fieldParams.length;a++)if(e.fieldParams[a].param==t.originalName){e.fieldParams[a].value=t.value;break}}))})),stimulsoftHelper.setParamsInFilter(m.dictionary.dataSources,r.datasources);var f=()=>{var t=new Stimulsoft.Viewer.StiViewerOptions;t.toolbar.showAboutButton=!1,o?(t.toolbar.visible=o.showToolbar,t.appearance.scrollbarsMode=o.showScrollbar,null!=o.height&&(t.height=o.height+"px")):(t.appearance.scrollbarsMode=!0,t.height=l);var e=new Stimulsoft.Viewer.StiViewer(t,u,!1);return e.report=m,Stimulsoft.Viewer.StiJsViewer.prototype.IsTouchDevice()&&(e.options.appearance.interfaceType=Stimulsoft.Viewer.StiInterfaceType.Touch),e};if(o&&o.$element)f().renderHtml(o.$element[0]);else{function h(e){if(e&&c())d(e);else var a=setInterval((function(){var r=$("<div/>");r.attr("id","contentReport"),r.attr("width","100%");var o=$("#reportView .modal-body");o.get(0)&&(o.html(r),$("#reportViewContext .modal-dialog").css("width","95%"),setTimeout((function(){console.log("open[#reportViewContext]"),$("body").append(p),cronapi.screen.showModal("reportView"),t.reportConfig&&"HTML"===t.reportConfig.renderType?f().renderHtml("contentReport"):$("#contentReport").html('<iframe src="'+e+'" width="100%" height="'+l+'"></iframe>'),setTimeout((function(){var t,e;e=setInterval((function(){var a=$("#"+u);a.length?t||(t=a.parent(),t.parent().parent().parent().parent()):(console.log("cleared interval: "+u),clearInterval(e))}),100)}),100)}),100),clearInterval(a))}),200)}if(t.reportConfig&&"PDFSERVER"!==t.reportConfig.renderType){var g=new Stimulsoft.Report.Export.StiPdfExportSettings,v=new Stimulsoft.Report.Export.StiPdfExportService,w=new Stimulsoft.System.IO.MemoryStream;m.renderAsync((function(){t.reportConfig&&"PDF"!==t.reportConfig.renderType&&void 0!==t.reportConfig.renderType?h(null):v.exportToAsync((function(){var t=w.toArray(),e=new Blob([new Uint8Array(t)],{type:"application/pdf"});h(URL.createObjectURL(e))}),m,w,g)}),!1)}else this.getPDF({reportName:t.reportName,parameters:a}).then(function(t){var e=new Blob([new Uint8Array(t.data)],{type:"application/pdf"});h(URL.createObjectURL(e))}.bind(this))}$(`#${u}`).find("img").attr("alt",""),$(`#${u}`).find("input").attr("aria-label",u)},this.showParameters=function(t){var e=t.parameters,r=[],o=0,n=function(){if(o<e.length){var i=e[o++];$.get("node_modules/cronapp-framework-js/components/reports/"+i.type+".parameter.html").done((function(t){var e,a,o;r.push((e=t,a="_field_",o=i.name,e.replace(new RegExp(function(t){return t.replace(/([.*+?^=!:()|\[\]\/\\])/g,"\\$1")}(a),"g"),o))),n()}))}else r.length>0&&a.open({templateUrl:"node_modules/cronapp-framework-js/components/reports/reports.parameters.html",controller:"ParameterController",resolve:{report:function(){return JSON.parse(JSON.stringify(t))},htmlParameters:function(){return JSON.parse(JSON.stringify(r))}}})}.bind(this);n()},this.mergeParam=function(t,e){var a=function(t,e){for(var a in Object.keys(e))if(r(e[a])&&t==Object.keys(e[a])[0])return Object.values(e[a])[0]};let r=t=>t&&{}.constructor===t.constructor;for(var o in Object.keys(t)){var n=t[o].name,i=(t[o].value,a(n,e));i?t[o].value=i:Array.isArray(e)&&!r(e[o])&&(t[o].value=e[o])}return t},this.setVariablesBasedOnParams=function(t,e){for(var a in e){var r=Object.keys(e[a])[0],o=e[a][r];for(var n in t)if(t[n]&&t[n].Name&&t[n].Name===r){t[n].Value=o;break}}},this.hasParameterWithOutValue=function(t){for(var e in Object.keys(t))if(!t[e].value)return!0;return!1},this.getDatasourcesInBandDashBoard=function(t){var e={hasParam:!1,datasources:[]},a=Stimulsoft.Report.StiReport.createNewDashboard();return a.load(t),a.pages&&a.pages.list&&a.pages.list.length>0&&a.pages.toList().forEach((function(t){t.components.toList().forEach((function(t){(t.getDataSources()||[]).forEach((function(t){var a=stimulsoftHelper.getParamsFromFilter(t),r=stimulsoftHelper.getQueryName(t);e.datasources.push({name:t.name,customId:r,fieldParams:a,queryParams:[]}),a.length&&(e.hasParam=!0)}))}))})),e},this.getDatasourcesInBand=function(t){var e=new Stimulsoft.Report.StiReport;return e.load(t),stimulsoftHelper.getDatasourcesInBand(e)},this.loadSriptsStimulsoft=function(t){var e=!0,a=p.length,r=0;Pace.options.initialRate=.7,Pace.options.minTime=1750,Pace.options.maxProgressPerFrame=1,Pace.options.ghostTime=12e4;let o=setInterval((()=>Pace.restart()),2500);p.forEach(function(n,i){this.loadScript(n,(function(n){r++,n||(e=!1),r==a&&(clearInterval(o),Pace.options.initialRate=.03,Pace.options.minTime=250,Pace.options.maxProgressPerFrame=20,Pace.options.ghostTime=10,Pace.stop(),t(e))}))}.bind(this))},this.loadScript=function(t,e){if($.inArray(t,l)>=0)e&&e(!0);else if(-1!=t.indexOf(".css")){var a=document.createElement("link");a.rel="stylesheet",a.type="text/css",a.href=t,a.media="all",a.onload=function(){l.push(t),e&&e(!0)},a.onerror=function(){e&&e(!1)};try{document.getElementsByTagName("head")[0].appendChild(a)}catch(t){console.log(t)}}else{var r=document.createElement("script");r.type="text/javascript",r.readyState?r.onreadystatechange=function(){"loaded"!=r.readyState&&"complete"!=r.readyState||(r.onreadystatechange=null,l.push(t),e&&e(!0))}:r.onload=function(){l.push(t),e&&e(!0)},r.src=t,document.getElementsByTagName("head")[0].appendChild(r)}},this.openReport=function(t,e,a){this.getReport(t).then(function(t){if(t&&t.data){var o=t.data.reportName.endsWith(".report"),n=t.data.reportName.endsWith(".dashboard");o||n?this.loadSriptsStimulsoft(function(o){o?(this.initializeStimulsoft(r.use()),this.getContentAsString(t.data).then(function(o){var i=this.getDatasourcesInBand(o.data);n&&(i=this.getDatasourcesInBandDashBoard(o.data)),this.getDataSourcesParams(i).then(function(n){i=n.data,t.data.parameters=stimulsoftHelper.parseToGroupedParam(i.datasources),t.data.contentData=o.data,t.data.datasourcesInBand=i,e&&(t.data.parameters=this.mergeParam(t.data.parameters,e),t.data.contentData.Dictionary=t.data.contentData.Dictionary||{},this.setVariablesBasedOnParams(t.data.contentData.Dictionary.Variables,e)),this.hasParameterWithOutValue(t.data.parameters)&&!a?(t.data.parameters.forEach((function(t){t.name=r.instant(t.name)})),this.showParameters(JSON.parse(JSON.stringify(t.data)))):this.openStimulsoftReport(o.data,t.data.parameters,t.data.datasourcesInBand,a)}.bind(this))}.bind(this),function(t){var e=cronapi.internal.getErrorMessage(t,t.statusText);s.Notification.error(e)}.bind(this))):s.Notification.error("Error loading report script")}.bind(this)):0==t.data.parameters.length||1==t.data.parameters.length&&"DATA_LIMIT"==t.data.parameters[0].name?this.getPDFAsFile(t.data.reportName).then(function(t){this.openURLContent(t.data)}.bind(this),function(t){var e=cronapi.internal.getErrorMessage(t,t.statusText);s.Notification.error(e)}.bind(this)):(e&&(t.data.parameters=this.mergeParam(t.data.parameters,e)),this.hasParameterWithOutValue(t.data.parameters)?this.showParameters(JSON.parse(JSON.stringify(t.data))):this.getPDFAsFile(t.data).then(function(t){this.openURLContent(t.data)}.bind(this)))}}.bind(this))}}]);
|
package/dist/js/services.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
app,angular.module("custom.services",[]);
|
package/dist/js/stateProvider.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
window.stateProviderDefine={handle:
|
|
1
|
+
window.stateProviderDefine={handle:e=>{if(window.customStateProvider)window.customStateProvider(e);else{let t="withAuth"===$("script[src*=app\\.js]")[0].src.split("type=")[1]?"withAuth":"withoutAuth";!window.stateProviderDefine[t]||window.stateProviderDefine[t](e)}},withAuth:e=>{e.state("main",{url:"",controller:"LoginController",templateUrl:window.mainRoute}).state("views",{url:"/{name:.*}",controller:"PageController",templateUrl:function(e){return e.name?"views/"+e.name+".view.html":window.mainRoute}}).state("login",{url:"/login",controller:"LoginController",templateUrl:"views/login.view.html"}).state("loginReturnUrl",{url:"/login?:returnUrl",controller:"LoginController",templateUrl:"views/login.view.html"}).state("signup",{url:"/public/signup",controller:"SignupController",templateUrl:"views/public/signup.view.html"}).state("reset-password",{url:"/public/reset-password",controller:"ResetPasswordController",templateUrl:"views/public/reset-password.view.html"}).state("social",{url:"/connected",controller:"SocialController",templateUrl:"views/login.view.html"}).state("socialError",{url:"/notconnected",controller:"SocialController",templateUrl:"views/login.view.html"}).state("publicRoot",{url:"/public/{name:.*}",controller:"PageController",templateUrl:function(e){return"views/public/"+e.name+".view.html"}}).state("public",{url:"/home/public",controller:"PublicController",templateUrl:function(e){return"views/public/home.view.html"}}).state("public.pages",{url:"/{name:.*}",controller:"PageController",templateUrl:function(e){return"views/public/"+e.name+".view.html"}}).state("home",{url:"/home",controller:"HomeController",templateUrl:"views/logged/home.view.html",resolve:{data:["$translate",function(e){e.refresh()}]}}).state("home.pages",{url:"/{name:.*}",controller:"PageController",templateUrl:function(e){return"views/"+e.name+".view.html"}}).state("404",{controller:"PageController",templateUrl:function(e){return"views/error/404.view.html"}}).state("403",{controller:"PageController",templateUrl:function(e){return"views/error/403.view.html"}})},withoutAuth:e=>{window.mainRoute=-1!==window.mainRoute.indexOf("views/login.view.html")?"views/public/home.view.html":window.mainRoute,e.state("index",{url:"",controller:"HomeController",templateUrl:window.mainRoute}).state("main",{url:"/",controller:"HomeController",templateUrl:window.mainRoute}).state("home",{url:"/home",controller:"HomeController",templateUrl:window.mainRoute}).state("home.pages",{url:"/{name:.*}",controller:"PageController",templateUrl:function(e){return e.name?"views/"+e.name+".view.html":window.mainRoute}}).state("404",{controller:"PageController",templateUrl:function(e){return"views/error/404.view.html"}}).state("403",{controller:"PageController",templateUrl:function(e){return"views/error/403.view.html"}})}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
app,angular.module("upload.services",[]).service("UploadService",["$http","$compile","$modal","Upload",function(e,o,t,a){var n=$("body");angular.element(n.get(0)).scope(),this.ensureProps=e=>(!e.filter||(e.filter=e.filter.replace(/\s/g,"")),e),this.upload=function(e){let o=this.ensureProps(e);t.open({templateUrl:"node_modules/cronapp-framework-js/components/upload/upload.html",controller:"UploadController",resolve:{data:function(){return o}}})}.bind(this)}]),angular.module("custom.controllers").controller("UploadController",["$scope","$http","$translate","$stateParams","$location","$http","$modalInstance","data",function(e,o,t,a,n,o,l,r){app.registerEventsCronapi(e,t),e.params=a,e.$http=o;var i=n.search();for(var s in i)i.hasOwnProperty(s)&&(e.params[s]=i[s]);e.files=[],e.uploading=!1,e.uploaded=!0,e.progress=0,e.data=r,e.message=t.instant("Upload.oneFile"),"true"==r.multiple&&(e.message=t.instant("Upload.multipleFile")),r.description&&(e.message=r.description),e.safeApply=safeApply,e.uploadFile=function(a){var n=e.data.scope,l="api/cronapi/upload/"+r.id,i=new FormData;if(0==a.length)this.Notification.error(function(e){var o=[].slice.call(arguments,1),t=0;return e.replace(/%s/g,(function(){return o[t++]}))}(t.instant("Upload.errorValidation"),r.maxSize,r.filter));else{for(var s=0;s<a.length;s++)i.append("file",a[s]),console.log(a[s].$valid);var p=JSON.parse(localStorage.getItem("_u"));let t=window.isUsingCookie()?{"Content-Type":void 0}:{"Content-Type":void 0,"X-AUTH-TOKEN":p?p.token:""};this.$promise=o({method:"POST",url:(window.hostApp||"")+l,data:i,headers:t,onProgress:function(o){this.safeApply((function(){if(o.lengthComputable){var t=o.loaded/o.total*100|0;e.progress=t}e.uploading=!0,console.log(t)}))}.bind(this)}).then(function(o,t,a,l){n.cronapi.evalInContext(JSON.stringify(o)).then((o=>{e.uploaded=!0,e.uploading=!1,e.close()}))}.bind(this)).catch(function(o,t,a){let n=o.error;o&&o.data&&(n=o.data.error),this.Notification.error(n),e.uploading=!1,e.close()}.bind(this))}}.bind(e),e.close=function(){l.dismiss("cancel")}}]);
|
package/gulpfile.js
CHANGED
|
@@ -1,53 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return gulp.src(['js/**'])
|
|
13
|
-
.pipe(ngAnnotate())
|
|
14
|
-
.pipe(minify({
|
|
1
|
+
import gulp from 'gulp';
|
|
2
|
+
import uglify from 'gulp-uglify';
|
|
3
|
+
import uglifycss from 'gulp-uglifycss';
|
|
4
|
+
import htmlmin from 'gulp-htmlmin';
|
|
5
|
+
import ngAnnotate from 'gulp-ng-annotate-patched';
|
|
6
|
+
import terser from 'gulp-terser';
|
|
7
|
+
|
|
8
|
+
gulp.task('minify-js', function () {
|
|
9
|
+
return gulp.src(['js/**/*.js'])
|
|
10
|
+
.pipe(ngAnnotate())
|
|
11
|
+
.pipe(terser({
|
|
15
12
|
mangle: {
|
|
16
|
-
|
|
13
|
+
keep_classnames: true
|
|
17
14
|
}
|
|
18
15
|
}))
|
|
19
16
|
.pipe(gulp.dest('dist/js/'));
|
|
20
17
|
});
|
|
21
18
|
|
|
22
|
-
gulp.task('minify-css', function() {
|
|
19
|
+
gulp.task('minify-css', function () {
|
|
23
20
|
return gulp.src(['css/**/*', '!css/fonts/**'])
|
|
24
21
|
.pipe(uglifycss())
|
|
25
22
|
.pipe(gulp.dest('dist/css/'));
|
|
26
23
|
});
|
|
27
24
|
|
|
28
|
-
gulp.task('minify-
|
|
29
|
-
return gulp.src('img/**')
|
|
30
|
-
.pipe(imagemin({
|
|
31
|
-
optimizationLevel: 5,
|
|
32
|
-
progressive: true,
|
|
33
|
-
interlaced: true
|
|
34
|
-
}))
|
|
35
|
-
.pipe(gulp.dest('dist/img/'));
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
gulp.task('minify-components-css', function() {
|
|
25
|
+
gulp.task('minify-components-css', function () {
|
|
39
26
|
return gulp.src(['components/css/**'])
|
|
40
27
|
.pipe(uglifycss())
|
|
41
28
|
.pipe(gulp.dest('dist/components/css/'));
|
|
42
29
|
});
|
|
43
30
|
|
|
44
|
-
gulp.task('minify-components-js', function() {
|
|
31
|
+
gulp.task('minify-components-js', function () {
|
|
45
32
|
return gulp.src(['components/js/**'])
|
|
46
33
|
.pipe(uglify())
|
|
47
34
|
.pipe(gulp.dest('dist/components/js/'));
|
|
48
35
|
});
|
|
49
36
|
|
|
50
|
-
gulp.task('minify-components-templates', function() {
|
|
37
|
+
gulp.task('minify-components-templates', function () {
|
|
51
38
|
return gulp.src(['components/templates/**'])
|
|
52
39
|
.pipe(htmlmin({
|
|
53
40
|
collapseWhitespace: true
|
|
@@ -55,7 +42,7 @@ gulp.task('minify-components-templates', function() {
|
|
|
55
42
|
.pipe(gulp.dest('dist/components/templates/'));
|
|
56
43
|
});
|
|
57
44
|
|
|
58
|
-
gulp.task('minify-components-report', function() {
|
|
45
|
+
gulp.task('minify-components-report', function () {
|
|
59
46
|
return gulp.src(['components/reports/**'])
|
|
60
47
|
.pipe(htmlmin({
|
|
61
48
|
collapseWhitespace: true
|
|
@@ -63,19 +50,18 @@ gulp.task('minify-components-report', function() {
|
|
|
63
50
|
.pipe(gulp.dest('dist/components/reports/'));
|
|
64
51
|
});
|
|
65
52
|
|
|
66
|
-
gulp.task('i18n', function() {
|
|
53
|
+
gulp.task('i18n', function () {
|
|
67
54
|
return gulp.src('i18n/**').pipe(gulp.dest('dist/i18n/'));
|
|
68
55
|
});
|
|
69
56
|
|
|
70
|
-
gulp.task('build',
|
|
57
|
+
gulp.task('build', gulp.series(
|
|
71
58
|
'minify-js',
|
|
72
59
|
'minify-css',
|
|
73
|
-
'minify-img',
|
|
74
60
|
'minify-components-css',
|
|
75
61
|
'minify-components-js',
|
|
76
62
|
'minify-components-templates',
|
|
77
63
|
'minify-components-report',
|
|
78
64
|
'i18n'
|
|
79
|
-
|
|
65
|
+
));
|
|
80
66
|
|
|
81
|
-
gulp.task('default',
|
|
67
|
+
gulp.task('default', gulp.series('build'));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg width="35" height="35" viewBox="0 0 35 35" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<circle cx="5.5" cy="19.5" r="3.25" stroke="#C9C9C9" stroke-width="1.5"/>
|
|
3
|
+
<circle cx="15.5" cy="19.5" r="3.25" stroke="#C9C9C9" stroke-width="1.5"/>
|
|
4
|
+
<circle cx="27" cy="19" r="4.75" stroke="#C9C9C9" stroke-width="1.5"/>
|
|
5
|
+
<path d="M9 19H12" stroke="#C9C9C9" stroke-width="1.5"/>
|
|
6
|
+
<path d="M19 19H23" stroke="#C9C9C9" stroke-width="1.5"/>
|
|
7
|
+
<path d="M24.5 19L26.5909 21L29.5 18" stroke="#C9C9C9" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/>
|
|
8
|
+
</svg>
|
package/js/app.js
CHANGED
|
@@ -65,25 +65,7 @@ var app = (function() {
|
|
|
65
65
|
.config([
|
|
66
66
|
'$httpProvider',
|
|
67
67
|
function($httpProvider) {
|
|
68
|
-
|
|
69
|
-
'$q',
|
|
70
|
-
'$rootScope',
|
|
71
|
-
function($q, $rootScope) {
|
|
72
|
-
var service = {
|
|
73
|
-
'request': function(config) {
|
|
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
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return config;
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
return service;
|
|
84
|
-
}
|
|
85
|
-
];
|
|
86
|
-
$httpProvider.interceptors.push(interceptor);
|
|
68
|
+
$httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
|
|
87
69
|
}
|
|
88
70
|
])
|
|
89
71
|
.config( [
|
|
@@ -279,7 +261,10 @@ var app = (function() {
|
|
|
279
261
|
const $stateChangeError = function(error) {
|
|
280
262
|
if (error) {
|
|
281
263
|
const errorMessage = error.toString();
|
|
282
|
-
if (
|
|
264
|
+
if (error.type === 6 && error.detail.config.url.includes("=_.view.html") ) {
|
|
265
|
+
$state.go('login');
|
|
266
|
+
}
|
|
267
|
+
else if (errorMessage.includes('=404')) {
|
|
283
268
|
$state.go('404');
|
|
284
269
|
}
|
|
285
270
|
else if (errorMessage.includes('=403')) {
|
|
@@ -563,4 +548,4 @@ var registerComponentScripts = function() {
|
|
|
563
548
|
var index = $(currentCarousel + ' .carousel-indicators li').index(this);
|
|
564
549
|
$(currentCarousel + ' > div').carousel(index);
|
|
565
550
|
});
|
|
566
|
-
};
|
|
551
|
+
};
|
package/js/controllers.js
CHANGED
|
@@ -11,9 +11,6 @@ if (!window.hostApp) {
|
|
|
11
11
|
url: window.hostApp + 'auth/refresh'
|
|
12
12
|
}).then(function (data, status, headers, config) {
|
|
13
13
|
data = getRequestData(data);
|
|
14
|
-
if (window.isUsingCookie()) {
|
|
15
|
-
delete data.token;
|
|
16
|
-
}
|
|
17
14
|
//Keeping the user information, the auth/refresh only has name and username info
|
|
18
15
|
if (localStorage.getItem("_u")) {
|
|
19
16
|
let currentSession = JSON.parse(localStorage.getItem("_u"));
|
|
@@ -50,7 +47,10 @@ if (!window.hostApp) {
|
|
|
50
47
|
return;
|
|
51
48
|
}
|
|
52
49
|
|
|
53
|
-
|
|
50
|
+
let headerValues = {
|
|
51
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
|
52
|
+
}
|
|
53
|
+
|
|
54
54
|
$http({
|
|
55
55
|
method: 'POST',
|
|
56
56
|
url: window.hostApp + 'auth/confirm-reset-password',
|
|
@@ -123,36 +123,26 @@ if (!window.hostApp) {
|
|
|
123
123
|
$scope.redirectToLogin = function() {
|
|
124
124
|
$scope.cronapi.social.ssoLogin();
|
|
125
125
|
};
|
|
126
|
-
|
|
127
|
-
if(localStorage.getItem('_u') && JSON.parse(localStorage.getItem('_u')).token ){
|
|
128
|
-
refreshToken($http, function(){
|
|
129
|
-
$scope.goHome();
|
|
130
|
-
}, function(){
|
|
131
|
-
localStorage.removeItem('_u');
|
|
132
|
-
})
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
$scope.autoLogin();
|
|
126
|
+
|
|
136
127
|
if (localStorage.getItem('redir_mob')) {
|
|
137
128
|
localStorage.removeItem('redir_mob');
|
|
138
|
-
$window.location.href = '/mobileapp';
|
|
139
|
-
}
|
|
140
|
-
if ($cookies.get('_u')) {
|
|
141
|
-
if (!localStorage.getItem('_u')) {
|
|
142
|
-
var decodedUser = decodeURIComponent($cookies.get('_u'));
|
|
143
|
-
if (window.isUsingCookie()) {
|
|
144
|
-
delete decodedUser.token;
|
|
145
|
-
}
|
|
146
|
-
localStorage.setItem("_u", decodedUser);
|
|
147
|
-
}
|
|
148
|
-
$scope.goHome();
|
|
129
|
+
$window.location.href = '/mobileapp/#/app/logged/home';
|
|
149
130
|
}
|
|
131
|
+
|
|
150
132
|
$scope.message = {};
|
|
151
133
|
$scope.renderRecaptcha = function(){
|
|
152
134
|
window.grecaptcha.render('loginRecaptcha');
|
|
153
135
|
window.grecaptcha.reset();
|
|
154
136
|
};
|
|
155
|
-
|
|
137
|
+
|
|
138
|
+
function checkSession() {
|
|
139
|
+
$http({
|
|
140
|
+
method : 'GET',
|
|
141
|
+
url : window.hostApp + 'me'
|
|
142
|
+
}).then(handleSuccess);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
$scope.login = function(username, password) {
|
|
156
146
|
$scope.message.error = undefined;
|
|
157
147
|
if($('form').find('*[class=g-recaptcha]').length){
|
|
158
148
|
if(!$scope.captcha_token && $('form').find('*[class=g-recaptcha]').attr("data-sitekey")=== ""){
|
|
@@ -178,17 +168,16 @@ if (!window.hostApp) {
|
|
|
178
168
|
'Content-Type' : 'application/x-www-form-urlencoded'
|
|
179
169
|
};
|
|
180
170
|
|
|
181
|
-
// Necessario para concluir a autenticação via SSO. Neste momento ainda não existe o cookie
|
|
182
|
-
headerValues["X-AUTH-TOKEN"] = token;
|
|
183
|
-
|
|
184
171
|
$http({
|
|
185
172
|
method : 'POST',
|
|
186
|
-
url : window.hostApp + '
|
|
173
|
+
url : window.hostApp + 'login',
|
|
187
174
|
data : $.param(user),
|
|
188
175
|
headers : headerValues
|
|
189
|
-
}).then(
|
|
176
|
+
}).then(checkSession).catch(handleError);
|
|
190
177
|
};
|
|
191
178
|
|
|
179
|
+
checkSession();
|
|
180
|
+
|
|
192
181
|
$scope.forgotPassword = function () {
|
|
193
182
|
if (forgotPasswordEmail.value === '') {
|
|
194
183
|
Notification.error($translate.instant('ForgotPasswordEmailCanNotBeEmpty'));
|
|
@@ -215,29 +204,27 @@ if (!window.hostApp) {
|
|
|
215
204
|
};
|
|
216
205
|
|
|
217
206
|
function handleSuccess(data, status, headers, config) {
|
|
218
|
-
data
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
207
|
+
if (data.status == 200) {
|
|
208
|
+
data = getRequestData(data);
|
|
209
|
+
// Store data response on session storage
|
|
210
|
+
// The local storage will be cleaned when the browser window is closed
|
|
211
|
+
if (typeof (Storage) !== "undefined") {
|
|
212
|
+
// save the user data on localStorage
|
|
213
|
+
localStorage.setItem("_u", JSON.stringify(data));
|
|
214
|
+
$rootScope.session = JSON.parse(localStorage._u);
|
|
215
|
+
} else {
|
|
216
|
+
// Sorry! No Web Storage support.
|
|
217
|
+
// The home page may not work if it depends
|
|
218
|
+
// on the logged user data
|
|
225
219
|
}
|
|
226
|
-
localStorage.setItem("_u", JSON.stringify(data));
|
|
227
|
-
$rootScope.session = JSON.parse(localStorage._u);
|
|
228
|
-
}
|
|
229
|
-
else {
|
|
230
|
-
// Sorry! No Web Storage support.
|
|
231
|
-
// The home page may not work if it depends
|
|
232
|
-
// on the logged user data
|
|
233
|
-
}
|
|
234
220
|
|
|
235
|
-
|
|
236
|
-
|
|
221
|
+
// Redirect to home page
|
|
222
|
+
$scope.goHome();
|
|
237
223
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
224
|
+
// Verify if the 'onLogin' event is defined and it is a function (it can be a string pointing to a non project blockly) and run it.
|
|
225
|
+
if ($scope.blockly && $scope.blockly.events && $scope.blockly.events.onLogin && $scope.blockly.events.onLogin instanceof Function) {
|
|
226
|
+
$scope.blockly.events.onLogin();
|
|
227
|
+
}
|
|
241
228
|
}
|
|
242
229
|
}
|
|
243
230
|
|
|
@@ -370,7 +357,7 @@ if (!window.hostApp) {
|
|
|
370
357
|
$('#themeSytleSheet').attr('href', "node_modules/cronapp-framework-js/css/themes/" + value + ".min.css");
|
|
371
358
|
}
|
|
372
359
|
});
|
|
373
|
-
if (localStorage.getItem('_u')
|
|
360
|
+
if (localStorage.getItem('_u')){
|
|
374
361
|
refreshToken($http, function() {},function() {
|
|
375
362
|
localStorage.removeItem('_u');
|
|
376
363
|
if (window.location.hash) {
|
|
@@ -394,7 +381,7 @@ if (!window.hostApp) {
|
|
|
394
381
|
|
|
395
382
|
$rootScope.logout = function logout() {
|
|
396
383
|
$http({
|
|
397
|
-
method : '
|
|
384
|
+
method : 'POST',
|
|
398
385
|
url : window.hostApp + 'logout',
|
|
399
386
|
headers : {
|
|
400
387
|
'Content-Type' : 'application/json'
|
|
@@ -530,9 +517,6 @@ if (!window.hostApp) {
|
|
|
530
517
|
function changeSuccess(data, status, headers, config) {
|
|
531
518
|
$rootScope.session.theme = theme;
|
|
532
519
|
$rootScope.session.user.theme = theme;
|
|
533
|
-
if (window.isUsingCookie()) {
|
|
534
|
-
delete $rootScope.session.token;
|
|
535
|
-
}
|
|
536
520
|
localStorage.setItem("_u", JSON.stringify($rootScope.session));
|
|
537
521
|
}
|
|
538
522
|
|
|
@@ -585,7 +569,7 @@ if (!window.hostApp) {
|
|
|
585
569
|
window.localStorage.removeItem("logoutUri");
|
|
586
570
|
}
|
|
587
571
|
|
|
588
|
-
$scope.
|
|
572
|
+
$scope.loginWithToken();
|
|
589
573
|
});
|
|
590
574
|
|
|
591
575
|
}(app));
|
package/js/directives.js
CHANGED
|
@@ -217,6 +217,26 @@
|
|
|
217
217
|
}
|
|
218
218
|
}]);
|
|
219
219
|
|
|
220
|
+
app.directive('crnTooltip', function () {
|
|
221
|
+
return {
|
|
222
|
+
restrict: 'A',
|
|
223
|
+
link: function (scope, element, attr) {
|
|
224
|
+
if (attr.crnTooltip && attr.crnTooltip.toString() && attr.crnTooltip.toString().trim().length > 0) {
|
|
225
|
+
try {
|
|
226
|
+
let configTooltip = JSON.parse(attr.crnTooltip.toString());
|
|
227
|
+
if (configTooltip.content && configTooltip.content.toString() && attr.crnTooltip.toString().trim().length > 0) {
|
|
228
|
+
$(element).kendoTooltip(configTooltip).data("kendoTooltip");
|
|
229
|
+
}
|
|
230
|
+
} catch (e) {
|
|
231
|
+
console.error("Formato do atributo tooltip deve ser um json.");
|
|
232
|
+
console.error("Valor atual: " + attr.crnTooltip);
|
|
233
|
+
console.error("Error ocorrido: " + e);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
});
|
|
239
|
+
|
|
220
240
|
app.directive('input', transformText);
|
|
221
241
|
|
|
222
242
|
app.directive('textarea', transformText);
|
|
@@ -3700,6 +3720,10 @@
|
|
|
3700
3720
|
if (!window.isUsingCookie()) {
|
|
3701
3721
|
xhr.setRequestHeader ("X-AUTH-TOKEN", cronapi.util.getUserToken());
|
|
3702
3722
|
}
|
|
3723
|
+
const csrfToken = document.cookie.match(new RegExp('(^| )XSRF-TOKEN=([^;]+)'));
|
|
3724
|
+
if (csrfToken) {
|
|
3725
|
+
xhr.setRequestHeader('X-XSRF-TOKEN', csrfToken[2]);
|
|
3726
|
+
}
|
|
3703
3727
|
},
|
|
3704
3728
|
error: () => reject(),
|
|
3705
3729
|
type: 'GET',
|
|
@@ -3842,6 +3866,10 @@
|
|
|
3842
3866
|
if (!window.isUsingCookie()) {
|
|
3843
3867
|
xhr.setRequestHeader ("X-AUTH-TOKEN", cronapi.util.getUserToken());
|
|
3844
3868
|
}
|
|
3869
|
+
const csrfToken = document.cookie.match(new RegExp('(^| )XSRF-TOKEN=([^;]+)'));
|
|
3870
|
+
if (csrfToken) {
|
|
3871
|
+
xhr.setRequestHeader('X-XSRF-TOKEN', csrfToken[2]);
|
|
3872
|
+
}
|
|
3845
3873
|
},
|
|
3846
3874
|
error: () => reject(),
|
|
3847
3875
|
type: 'GET',
|
|
@@ -3872,43 +3900,52 @@
|
|
|
3872
3900
|
});
|
|
3873
3901
|
return datasource;
|
|
3874
3902
|
},
|
|
3875
|
-
link: function
|
|
3876
|
-
|
|
3877
|
-
let $templateDyn = $('<div></div>');
|
|
3903
|
+
link: function(scope, element, attrs, ngModelCtrl) {
|
|
3878
3904
|
let options = JSON.parse(attrs.options);
|
|
3879
|
-
|
|
3880
3905
|
let helperDirective = this;
|
|
3881
|
-
|
|
3882
|
-
let
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3906
|
+
let $templateDyn = $('<div class="k-widget k-treeview k-treeview-lines"></div>');
|
|
3907
|
+
let dataSource = new kendo.data.HierarchicalDataSource({
|
|
3908
|
+
transport: {
|
|
3909
|
+
read: async (e) => (await app.kendoHelper.getCorrectlyDSPromise(options.dataSourceScreen.name, scope)).fetch({}, e)
|
|
3910
|
+
},
|
|
3911
|
+
schema: {
|
|
3912
|
+
model: {
|
|
3913
|
+
id: options.keys,
|
|
3914
|
+
hasChildren: i => i.hasChildren
|
|
3915
|
+
}
|
|
3887
3916
|
}
|
|
3888
|
-
|
|
3889
|
-
};
|
|
3890
|
-
|
|
3917
|
+
});
|
|
3891
3918
|
let kendoObj = $templateDyn.kendoTreeView({
|
|
3892
3919
|
dataSource: helperDirective.getDataSource(options, scope, ngModelCtrl),
|
|
3893
3920
|
dataTextField: options.textField,
|
|
3894
|
-
|
|
3895
|
-
change: async function(e) {
|
|
3921
|
+
change: async function() {
|
|
3896
3922
|
let item = this.dataItem(this.select());
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
cronappDatasource.active = changeObjectField(cronappDatasource, cronappDatasource.active);
|
|
3903
|
-
|
|
3904
|
-
ngModelCtrl.$setViewValue(cronappDatasource.active);
|
|
3923
|
+
let ds = await this.dataSource.transport.options.cronappDatasource();
|
|
3924
|
+
scope.safeApply(() => {
|
|
3925
|
+
ds.goTo(item);
|
|
3926
|
+
if (options.fieldType === 'key') ngModelCtrl.$setViewValue(ds.active = item);
|
|
3927
|
+
});
|
|
3905
3928
|
}
|
|
3906
3929
|
}).data('kendoTreeView');
|
|
3907
|
-
kendoObj.dataSource.transport.options.kendoObj = kendoObj;
|
|
3908
|
-
|
|
3909
3930
|
element.html($templateDyn);
|
|
3910
|
-
$compile($templateDyn)(
|
|
3911
|
-
|
|
3931
|
+
$compile($templateDyn)(scope);
|
|
3932
|
+
setTimeout(() => {
|
|
3933
|
+
let $container = element.closest('.component-holder');
|
|
3934
|
+
if (!$container.length) return;
|
|
3935
|
+
const updateClasses = () => {
|
|
3936
|
+
let colClass = ($container.attr('class') || '').match(/col-(lg|md|sm|xs)-\d+/g)?.find(c => c.includes('col-md-')) || 'col-md-12';
|
|
3937
|
+
$container.attr('class', $container.attr('class').replace(/col-(lg|md|sm|xs)-\d+/g, '').trim() + ` ${colClass}`);
|
|
3938
|
+
};
|
|
3939
|
+
updateClasses();
|
|
3940
|
+
const observer = new MutationObserver(updateClasses);
|
|
3941
|
+
observer.observe($container[0], {
|
|
3942
|
+
attributes: true,
|
|
3943
|
+
attributeFilter: ['class']
|
|
3944
|
+
});
|
|
3945
|
+
scope.$on('$destroy', () => {
|
|
3946
|
+
if (observer) observer.disconnect();
|
|
3947
|
+
});
|
|
3948
|
+
}, 1000);
|
|
3912
3949
|
}
|
|
3913
3950
|
};
|
|
3914
3951
|
}])
|
|
@@ -6574,8 +6611,14 @@ function useInputMaskPlugin(element, ngModelCtrl, scope, modelSetter, mask){
|
|
|
6574
6611
|
ngModelCtrl.$parsers.push(function (value) {
|
|
6575
6612
|
if (value != undefined && value != null && value !== '') {
|
|
6576
6613
|
var unmaskedvalue = $element.inputmask('unmaskedvalue');
|
|
6577
|
-
if (unmaskedvalue !== '')
|
|
6578
|
-
|
|
6614
|
+
if (unmaskedvalue !== '') {
|
|
6615
|
+
let tempType = $element.data('type');
|
|
6616
|
+
if (tempType == 'number' || tempType == 'money' || tempType == 'integer' || tempType == 'money-decimal') {
|
|
6617
|
+
return Number(unmaskedvalue.replace(",", "."));
|
|
6618
|
+
} else {
|
|
6619
|
+
return unmaskedvalue;
|
|
6620
|
+
}
|
|
6621
|
+
}
|
|
6579
6622
|
}
|
|
6580
6623
|
return null;
|
|
6581
6624
|
});
|