fng-reports 0.12.0-beta.182 → 0.12.0-beta.185
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/dist/fng-reports.js +21 -17
- package/dist/fng-reports.min.js +2 -2
- package/package.json +2 -2
- package/src/fng-reports.js +20 -16
package/dist/fng-reports.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! forms-angular 2022-
|
|
1
|
+
/*! forms-angular 2022-06-03 */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
formsAngular.controller('AnalysisCtrl', ['$rootScope', '$window', '$filter', '$scope', '$http', '$location', 'cssFrameworkService', 'routingService',
|
|
@@ -37,26 +37,30 @@ formsAngular.controller('AnalysisCtrl', ['$rootScope', '$window', '$filter', '$s
|
|
|
37
37
|
gridApi.selection.on.rowSelectionChanged($scope, function afterSelectionChange(rowItem) {
|
|
38
38
|
var url = $scope.reportSchema.drilldown;
|
|
39
39
|
if (url) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
40
|
+
if (typeof url === 'string') {
|
|
41
|
+
url = routingService.buildUrl(url.replace(/\|.+?\|/g, function (match) {
|
|
42
|
+
var param = match.slice(1, -1),
|
|
43
|
+
isParamTest = /\((.+)\)/.exec(param);
|
|
44
|
+
if (isParamTest) {
|
|
45
|
+
var instructions = $scope.reportSchema.params[isParamTest[1]];
|
|
46
|
+
if (instructions) {
|
|
47
|
+
$scope.param = $scope.record[isParamTest[1]];
|
|
48
|
+
if (instructions.conversionExpression) {
|
|
49
|
+
return $scope.$eval(instructions.conversionExpression);
|
|
50
|
+
} else {
|
|
51
|
+
return instructions.value;
|
|
52
|
+
}
|
|
49
53
|
} else {
|
|
50
|
-
return
|
|
54
|
+
return $scope.reportSchema.params[isParamTest[1]].value;
|
|
51
55
|
}
|
|
52
56
|
} else {
|
|
53
|
-
return
|
|
57
|
+
return rowItem.entity[param];
|
|
54
58
|
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
}));
|
|
60
|
+
window.location = url;
|
|
61
|
+
} else {
|
|
62
|
+
console.error('Was expecting drilldown to be string but it was ' + typeof url + ' (' + url + ')'); // trying to track down Sentry 3037641567
|
|
63
|
+
}
|
|
60
64
|
}
|
|
61
65
|
});
|
|
62
66
|
},
|
package/dist/fng-reports.min.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! forms-angular 2022-
|
|
1
|
+
/*! forms-angular 2022-06-03 */
|
|
2
2
|
"use strict";formsAngular.controller("AnalysisCtrl",["$rootScope","$window","$filter","$scope","$http","$location","cssFrameworkService","routingService",function(e,r,a,l,c,s,i,t){var p=!0,o=new ngGridPdfExportPlugin({inhibitButton:!0}),n=new ngGridCsvExportPlugin({inhibitButton:!0});function u(r){try{return JSON.parse(r)}catch(e){throw new Error(`Invalid JSON ${r}
|
|
3
|
-
`+e.message)}}if(angular.extend(l,t.parsePathFunc()(s.$$path)),l.reportSchema={columnDefs:[]},l.gridOptions={data:"report",columnDefs:l.reportSchema.columnDefs,showColumnMenu:!0,enableRowHeaderSelection:!1,enableFiltering:!1,showGridFooter:!1,reallyShowFooter:!1,showTotals:!0,enableColumnResizing:!0,footerRowHeight:65,multiSelect:!1,plugins:[o,n],onRegisterApi:function(r){l.gridApi=r,l.gridOptions.plugins.forEach(function(e){e.init(l,r.grid,null)}),r.selection.on.rowSelectionChanged(l,function(o){var e=l.reportSchema.drilldown;e&&(e=t.buildUrl(e.replace(/\|.+?\|/g,function(e){var r,e=e.slice(1,-1),t=/\((.+)\)/.exec(e);return t?(r=l.reportSchema.params[t[1]])?(l.param=l.record[t[1]],r.conversionExpression?l.$eval(r.conversionExpression):r.value):l.reportSchema.params[t[1]].value:o.entity[e]})),window.location=e)})}},l.report=[],!l.reportSchemaName&&s.$$search.r)switch(s.$$search.r.slice(0,1)){case"[":l.reportSchema.pipeline=u(s.$$search.r);break;case"{":angular.extend(l.reportSchema,u(s.$$search.r));break;default:throw new Error("No report instructions specified")}function d(e){for(var r in l.paramSchema=[],l.record={},e){var t,o;e.hasOwnProperty(r)&&((t=e[r]).noInput||(o=l.paramSchema.push({name:r,id:"fp_"+r,label:t.label||a("titleCase")(r),type:t.type||"text",required:!0,add:t.add||void 0,size:t.size||("bs3"===i.frameWork?"large":"medium")}),"select"===t.type&&(l[r+"_Opts"]=t.enum,l.paramSchema[o-1].options=r+"_Opts")),(o=/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3})(Z|[+ -]\d{4})$/.exec(t.value))&&(t.value=new Date(o[1])),l.record[r]=t.value)}l.$watch("record",function(e,r){r!==e&&(console.log("In the record watch ",JSON.stringify(e,null,2)),l.refreshQuery())},!0)}l.getTotalVal=function(r,e){var t="",o=_.find(l.reportSchema.columnDefs,function(e){return e.field===r});if(o)switch(o.totalsRow){case void 0:break;case"$SUM":for(var i=0,n=0;n<l.report.length;n++)i+=l.report[n][r];t=i,e&&(t=a(e)(t));break;default:t=o.totalsRow}return t},l.$on("exportToPDF",function(){o.createPDF()}),l.$on("exportToCSV",function(){n.createCSV()}),l.extractFilter=function(e,r){var t,o,i;e.cellFilter&&(-1===(i=e.cellFilter.indexOf(":"))?t=e.cellFilter:(t=e.cellFilter.slice(0,i).trim(),"'"!==(o=e.cellFilter.slice(i+1,999).trim())[0]&&'"'!==o[0]||(o=o.slice(1,-1))),i=angular.element(document.body).injector().get("$filter")(t.trim()),r[e.field]={filter:i,filterParam:o})};var f,m,h,g=document.querySelector("div.report-grow"),S=(g&&(f=g.offsetLeft,m=g.offsetTop+f,h=(h=document.querySelector("div.ui-grid-header"))?h.clientHeight:31,r=Math.floor((r.innerHeight-m-h-f)/30),angular.element(g).css("height",30*r+"px")),e.navScope);S.items=[{fn:o.createPDF,text:"Save as PDF"},{fn:n.createCSV,text:"Export as CSV"}],S.contextMenu="Report",l.titleWithSubstitutions=l.reportSchema.title,l.inhibitRefresh||(l.refreshQuery=function(){function t(e){return e.replace(/\|.+?\|/g,function(e){e=e.slice(1,-1),e=/\((.+)\)/.exec(e);return e?l.reportSchema.params[e[1]].value:""})}var e="/api/report/"+l.modelName,r="?",o=!1,i=s.$$url.match(/\?.*/);if(l.reportSchemaName?e+="/"+l.reportSchemaName:i&&(p&&(l.paramSchema=JSON.parse(s.search().r).params,d(l.paramSchema)),e+=r+i[0].slice(1),r="&",o=!0),l.paramSchema){for(var n in l.record)if(l.record.hasOwnProperty(n)){var a=l.reportSchema.params[n];if(l.record[n]&&""!==l.record[n])l.param=l.record[n],a.conversionExpression&&(l.param=l.$eval(a.conversionExpression)),e+=r+n+"="+l.param,r="&";else if(a.required)return}}else!o&&i&&(e+=r+i[0].slice(1),r="&");return c.get(e).then(function(e){var r;e&&e.data&&e.data.success?(r=e.data,l.report=r.report,l.reportSchema=r.schema,l.reportSchema.title=l.reportSchema.title||l.modelName,l.titleWithSubstitutions=t(l.reportSchema.title),l.gridOptions.enableFiltering=!!l.reportSchema.filter,S&&S.items&&(S.items.length=2,l.reportSchema.menu&&l.reportSchema.menu.forEach(function(e){S.items.push(JSON.parse(t(JSON.stringify(e))))})),p&&(p=!1,l.$watch("reportSchema.columnDefs",function(e){var r=!1;if(e){for(var t,o=0;o<e.length;o++)e[o].totalsRow&&(r=!0),e[o].align&&(t="fng-"+e[o].align,e[o].cellClass=e[o].cellClass||"",-1===e[o].cellClass.indexOf(t)&&(e[o].cellClass=e[o].cellClass+" "+t));e.forEach(function(e){e.width&&"string"==typeof e.width&&-1!==e.width.indexOf("px")&&(e.width=parseInt(e.width.slice(0,-2)))}),l.gridOptions.columnDefs=e}l.gridOptions.showTotals=r,l.gridOptions.reallyShowFooter=r,l.gridOptions.footerRowHeight=55+(r?10:0)},!0),!l.paramSchema&&r.schema.params&&d(r.schema.params))):(l.showError(JSON.stringify(e.data.error),"Invalid Response Error"),l.reportSchema.title="Error - see console log")},function(){l.showError("The server could not process the request","Error")})},l.refreshQuery()),l.showsContent=function(e){return/{{[\s]*COL_FIELD[\s]*}}/.test(e.replace(/(<([^>]+)>)/gi,""))},l.$on("$locationChangeStart",function(){delete S.contextMenu,delete S.items}),l.showError=function(r,e){if(l.alertTitle=e||"Error!","string"==typeof r)l.errorMessage=r;else if(r)if(r.message&&"string"==typeof r.message)l.errorMessage=r.message;else if(r.data&&r.data.message)l.errorMessage=r.data.message;else try{l.errorMessage=JSON.stringify(r)}catch(e){l.errorMessage=r}else l.errorMessage="An error occurred - that's all we got. Sorry.";l.errorHideTimer=window.setTimeout(function(){l.dismissError(),l.$digest()},3500+1e3*(l.alertTitle+l.errorMessage).length/50),l.errorVisible=!0,window.setTimeout(()=>{l.$digest()})},l.clearTimeout=function(){l.errorHideTimer&&(clearTimeout(l.errorHideTimer),delete l.errorHideTimer)},l.dismissError=function(){l.clearTimeout,l.errorVisible=!1,delete l.errorMessage,delete l.alertTitle},l.stickError=function(){clearTimeout(l.errorHideTimer)}}]);var COL_FIELD=/COL_FIELD/g;function ngGridCsvExportPlugin(e){var n=this;n.grid=null,n.scope=null,n.services=null,n.init=function(e,r,t){n.grid=r,n.scope=e,n.services=t},n.createCSV=function(){var e,r,t;e=n.scope.reportSchema.title+".csv",r="data:text/csv;charset=UTF-8,"+encodeURIComponent(n.prepareCSV()),(t=document.createElement("a")).download=e,t.href=r,e=new MouseEvent("click"),t.dispatchEvent(e)},n.prepareCSV=function(){function t(e,r){return null==e?"":r?r.filter(e,r.filterParam):"number"==typeof e?""+e:"boolean"==typeof e?e?"TRUE":"FALSE":("string"==typeof e?e:JSON.stringify(e)).replace(/"/g,'""')}function e(e){return e.substr(0,e.length-1)+"\n"}var o="",i={};return angular.forEach(n.grid.columns,function(e){n.scope.extractFilter(e,i),e.visible&&(!e.colDef.cellTemplate||n.scope.showsContent(e.colDef.cellTemplate))&&(void 0===e.width||"*"===e.width||0<e.width)?(o+='"'+t(e.displayName)+'",',e.doCSVExport=!0):e.doCSVExport=!1}),o=e(o),angular.forEach(n.scope.gridApi.core.getVisibleRows(),function(r){r.visible&&(angular.forEach(n.grid.columns,function(e){e.doCSVExport&&(o+='"'+t(r.entity[e.field],i[e.field])+'",')}),o=e(o))}),o}}function ngGridPdfExportPlugin(o){var a=this;a.grid=null,a.scope=null,a.services=null,a.options=o,a.init=function(e,r,t){a.grid=r,a.scope=e,a.services=t,o.inhibitButton||(e=r.$root.find(".ngFooterPanel"),null!=(t=r.$root.find(".ngFooterPanel .pdf-data-link-span"))&&t.remove(),e.append('<button class="pdf-data-link-span">PDF Export</button>'),e.on("click",function(){a.createPDF()}))},a.createPDF=function(){var t=[],i=[],o=[],e=[],n={},r=(angular.forEach(a.grid.columns,function(e,r){!e.visible||e.colDef.cellTemplate&&!a.scope.showsContent(e.colDef.cellTemplate)||(t.push(e.displayName),i.push(e.field)),e.colDef.totalsRow&&(o[e.field]=a.grid.getTotalVal(e.field,e.filter).toString()),a.scope.extractFilter(e,n)}),angular.forEach(a.scope.gridApi.core.getVisibleRows(),function(t){var o=[];t.visible&&(i.forEach(function(e){var r=t.entity[e];"string"==typeof(r=n[e]?n[e].filter(r,n[e].filterParam):r)&&(r=(r=(r=(r=(r=r.replace(/\u2019/g,"'")).replace(/\u2018/g,"'")).replace(/\u201c/g,'"')).replace(/\u201d/g,'"')).replace(/[^\x00-\xFF]/g,"")),o.push(r)}),e.push(o))}),new jspdf.jsPDF("landscape","mm","a4"));r.autoTable({head:[t],body:e}),window.open(r.output("bloburl"))}}formsAngular.directive("ngTotalCell",["$compile","$domUtilityService",function(i,t){return{scope:!1,compile:function(){return{pre:function(e,r){var t=e.col.cellTemplate.match(/{{COL_FIELD \|(.+)}}/),t=t?e.col.cellTemplate.replace("COL_FIELD |"+t[1],'getTotalVal("'+e.col.field+'","'+t[1]+'")'):e.col.cellTemplate.replace(COL_FIELD,'getTotalVal("'+e.col.field+'")'),o=e.col.enableCellEdit?(o=(o=e.col.cellEditTemplate).replace(DISPLAY_CELL_TEMPLATE,t)).replace(EDITABLE_CELL_TEMPLATE,e.col.editableCellTemplate.replace(COL_FIELD,"row.entity."+e.col.field)):t,t=i(o)(e);e.enableCellSelection&&-1===t[0].className.indexOf("ngSelectionCell")&&(t[0].setAttribute("tabindex",0),t.addClass("ngCellElement")),r.append(t)},post:function(e,r){e.enableCellSelection&&e.domAccessProvider.selectionHandlers(e,r),e.$on("ngGridEventDigestCell",function(){t.digest(e)})}}}}}]);
|
|
3
|
+
`+e.message)}}if(angular.extend(l,t.parsePathFunc()(s.$$path)),l.reportSchema={columnDefs:[]},l.gridOptions={data:"report",columnDefs:l.reportSchema.columnDefs,showColumnMenu:!0,enableRowHeaderSelection:!1,enableFiltering:!1,showGridFooter:!1,reallyShowFooter:!1,showTotals:!0,enableColumnResizing:!0,footerRowHeight:65,multiSelect:!1,plugins:[o,n],onRegisterApi:function(r){l.gridApi=r,l.gridOptions.plugins.forEach(function(e){e.init(l,r.grid,null)}),r.selection.on.rowSelectionChanged(l,function(o){var e=l.reportSchema.drilldown;e&&("string"==typeof e?(e=t.buildUrl(e.replace(/\|.+?\|/g,function(e){var r,e=e.slice(1,-1),t=/\((.+)\)/.exec(e);return t?(r=l.reportSchema.params[t[1]])?(l.param=l.record[t[1]],r.conversionExpression?l.$eval(r.conversionExpression):r.value):l.reportSchema.params[t[1]].value:o.entity[e]})),window.location=e):console.error("Was expecting drilldown to be string but it was "+typeof e+" ("+e+")"))})}},l.report=[],!l.reportSchemaName&&s.$$search.r)switch(s.$$search.r.slice(0,1)){case"[":l.reportSchema.pipeline=u(s.$$search.r);break;case"{":angular.extend(l.reportSchema,u(s.$$search.r));break;default:throw new Error("No report instructions specified")}function d(e){for(var r in l.paramSchema=[],l.record={},e){var t,o;e.hasOwnProperty(r)&&((t=e[r]).noInput||(o=l.paramSchema.push({name:r,id:"fp_"+r,label:t.label||a("titleCase")(r),type:t.type||"text",required:!0,add:t.add||void 0,size:t.size||("bs3"===i.frameWork?"large":"medium")}),"select"===t.type&&(l[r+"_Opts"]=t.enum,l.paramSchema[o-1].options=r+"_Opts")),(o=/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3})(Z|[+ -]\d{4})$/.exec(t.value))&&(t.value=new Date(o[1])),l.record[r]=t.value)}l.$watch("record",function(e,r){r!==e&&(console.log("In the record watch ",JSON.stringify(e,null,2)),l.refreshQuery())},!0)}l.getTotalVal=function(r,e){var t="",o=_.find(l.reportSchema.columnDefs,function(e){return e.field===r});if(o)switch(o.totalsRow){case void 0:break;case"$SUM":for(var i=0,n=0;n<l.report.length;n++)i+=l.report[n][r];t=i,e&&(t=a(e)(t));break;default:t=o.totalsRow}return t},l.$on("exportToPDF",function(){o.createPDF()}),l.$on("exportToCSV",function(){n.createCSV()}),l.extractFilter=function(e,r){var t,o,i;e.cellFilter&&(-1===(i=e.cellFilter.indexOf(":"))?t=e.cellFilter:(t=e.cellFilter.slice(0,i).trim(),"'"!==(o=e.cellFilter.slice(i+1,999).trim())[0]&&'"'!==o[0]||(o=o.slice(1,-1))),i=angular.element(document.body).injector().get("$filter")(t.trim()),r[e.field]={filter:i,filterParam:o})};var f,m,h,g=document.querySelector("div.report-grow"),S=(g&&(f=g.offsetLeft,m=g.offsetTop+f,h=(h=document.querySelector("div.ui-grid-header"))?h.clientHeight:31,r=Math.floor((r.innerHeight-m-h-f)/30),angular.element(g).css("height",30*r+"px")),e.navScope);S.items=[{fn:o.createPDF,text:"Save as PDF"},{fn:n.createCSV,text:"Export as CSV"}],S.contextMenu="Report",l.titleWithSubstitutions=l.reportSchema.title,l.inhibitRefresh||(l.refreshQuery=function(){function t(e){return e.replace(/\|.+?\|/g,function(e){e=e.slice(1,-1),e=/\((.+)\)/.exec(e);return e?l.reportSchema.params[e[1]].value:""})}var e="/api/report/"+l.modelName,r="?",o=!1,i=s.$$url.match(/\?.*/);if(l.reportSchemaName?e+="/"+l.reportSchemaName:i&&(p&&(l.paramSchema=JSON.parse(s.search().r).params,d(l.paramSchema)),e+=r+i[0].slice(1),r="&",o=!0),l.paramSchema){for(var n in l.record)if(l.record.hasOwnProperty(n)){var a=l.reportSchema.params[n];if(l.record[n]&&""!==l.record[n])l.param=l.record[n],a.conversionExpression&&(l.param=l.$eval(a.conversionExpression)),e+=r+n+"="+l.param,r="&";else if(a.required)return}}else!o&&i&&(e+=r+i[0].slice(1),r="&");return c.get(e).then(function(e){var r;e&&e.data&&e.data.success?(r=e.data,l.report=r.report,l.reportSchema=r.schema,l.reportSchema.title=l.reportSchema.title||l.modelName,l.titleWithSubstitutions=t(l.reportSchema.title),l.gridOptions.enableFiltering=!!l.reportSchema.filter,S&&S.items&&(S.items.length=2,l.reportSchema.menu&&l.reportSchema.menu.forEach(function(e){S.items.push(JSON.parse(t(JSON.stringify(e))))})),p&&(p=!1,l.$watch("reportSchema.columnDefs",function(e){var r=!1;if(e){for(var t,o=0;o<e.length;o++)e[o].totalsRow&&(r=!0),e[o].align&&(t="fng-"+e[o].align,e[o].cellClass=e[o].cellClass||"",-1===e[o].cellClass.indexOf(t)&&(e[o].cellClass=e[o].cellClass+" "+t));e.forEach(function(e){e.width&&"string"==typeof e.width&&-1!==e.width.indexOf("px")&&(e.width=parseInt(e.width.slice(0,-2)))}),l.gridOptions.columnDefs=e}l.gridOptions.showTotals=r,l.gridOptions.reallyShowFooter=r,l.gridOptions.footerRowHeight=55+(r?10:0)},!0),!l.paramSchema&&r.schema.params&&d(r.schema.params))):(l.showError(JSON.stringify(e.data.error),"Invalid Response Error"),l.reportSchema.title="Error - see console log")},function(){l.showError("The server could not process the request","Error")})},l.refreshQuery()),l.showsContent=function(e){return/{{[\s]*COL_FIELD[\s]*}}/.test(e.replace(/(<([^>]+)>)/gi,""))},l.$on("$locationChangeStart",function(){delete S.contextMenu,delete S.items}),l.showError=function(r,e){if(l.alertTitle=e||"Error!","string"==typeof r)l.errorMessage=r;else if(r)if(r.message&&"string"==typeof r.message)l.errorMessage=r.message;else if(r.data&&r.data.message)l.errorMessage=r.data.message;else try{l.errorMessage=JSON.stringify(r)}catch(e){l.errorMessage=r}else l.errorMessage="An error occurred - that's all we got. Sorry.";l.errorHideTimer=window.setTimeout(function(){l.dismissError(),l.$digest()},3500+1e3*(l.alertTitle+l.errorMessage).length/50),l.errorVisible=!0,window.setTimeout(()=>{l.$digest()})},l.clearTimeout=function(){l.errorHideTimer&&(clearTimeout(l.errorHideTimer),delete l.errorHideTimer)},l.dismissError=function(){l.clearTimeout,l.errorVisible=!1,delete l.errorMessage,delete l.alertTitle},l.stickError=function(){clearTimeout(l.errorHideTimer)}}]);var COL_FIELD=/COL_FIELD/g;function ngGridCsvExportPlugin(e){var n=this;n.grid=null,n.scope=null,n.services=null,n.init=function(e,r,t){n.grid=r,n.scope=e,n.services=t},n.createCSV=function(){var e,r,t;e=n.scope.reportSchema.title+".csv",r="data:text/csv;charset=UTF-8,"+encodeURIComponent(n.prepareCSV()),(t=document.createElement("a")).download=e,t.href=r,e=new MouseEvent("click"),t.dispatchEvent(e)},n.prepareCSV=function(){function t(e,r){return null==e?"":r?r.filter(e,r.filterParam):"number"==typeof e?""+e:"boolean"==typeof e?e?"TRUE":"FALSE":("string"==typeof e?e:JSON.stringify(e)).replace(/"/g,'""')}function e(e){return e.substr(0,e.length-1)+"\n"}var o="",i={};return angular.forEach(n.grid.columns,function(e){n.scope.extractFilter(e,i),e.visible&&(!e.colDef.cellTemplate||n.scope.showsContent(e.colDef.cellTemplate))&&(void 0===e.width||"*"===e.width||0<e.width)?(o+='"'+t(e.displayName)+'",',e.doCSVExport=!0):e.doCSVExport=!1}),o=e(o),angular.forEach(n.scope.gridApi.core.getVisibleRows(),function(r){r.visible&&(angular.forEach(n.grid.columns,function(e){e.doCSVExport&&(o+='"'+t(r.entity[e.field],i[e.field])+'",')}),o=e(o))}),o}}function ngGridPdfExportPlugin(o){var a=this;a.grid=null,a.scope=null,a.services=null,a.options=o,a.init=function(e,r,t){a.grid=r,a.scope=e,a.services=t,o.inhibitButton||(e=r.$root.find(".ngFooterPanel"),null!=(t=r.$root.find(".ngFooterPanel .pdf-data-link-span"))&&t.remove(),e.append('<button class="pdf-data-link-span">PDF Export</button>'),e.on("click",function(){a.createPDF()}))},a.createPDF=function(){var t=[],i=[],o=[],e=[],n={},r=(angular.forEach(a.grid.columns,function(e,r){!e.visible||e.colDef.cellTemplate&&!a.scope.showsContent(e.colDef.cellTemplate)||(t.push(e.displayName),i.push(e.field)),e.colDef.totalsRow&&(o[e.field]=a.grid.getTotalVal(e.field,e.filter).toString()),a.scope.extractFilter(e,n)}),angular.forEach(a.scope.gridApi.core.getVisibleRows(),function(t){var o=[];t.visible&&(i.forEach(function(e){var r=t.entity[e];"string"==typeof(r=n[e]?n[e].filter(r,n[e].filterParam):r)&&(r=(r=(r=(r=(r=r.replace(/\u2019/g,"'")).replace(/\u2018/g,"'")).replace(/\u201c/g,'"')).replace(/\u201d/g,'"')).replace(/[^\x00-\xFF]/g,"")),o.push(r)}),e.push(o))}),new jspdf.jsPDF("landscape","mm","a4"));r.autoTable({head:[t],body:e}),window.open(r.output("bloburl"))}}formsAngular.directive("ngTotalCell",["$compile","$domUtilityService",function(i,t){return{scope:!1,compile:function(){return{pre:function(e,r){var t=e.col.cellTemplate.match(/{{COL_FIELD \|(.+)}}/),t=t?e.col.cellTemplate.replace("COL_FIELD |"+t[1],'getTotalVal("'+e.col.field+'","'+t[1]+'")'):e.col.cellTemplate.replace(COL_FIELD,'getTotalVal("'+e.col.field+'")'),o=e.col.enableCellEdit?(o=(o=e.col.cellEditTemplate).replace(DISPLAY_CELL_TEMPLATE,t)).replace(EDITABLE_CELL_TEMPLATE,e.col.editableCellTemplate.replace(COL_FIELD,"row.entity."+e.col.field)):t,t=i(o)(e);e.enableCellSelection&&-1===t[0].className.indexOf("ngSelectionCell")&&(t[0].setAttribute("tabindex",0),t.addClass("ngCellElement")),r.append(t)},post:function(e,r){e.enableCellSelection&&e.domAccessProvider.selectionHandlers(e,r),e.$on("ngGridEventDigestCell",function(){t.digest(e)})}}}}}]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fng-reports",
|
|
3
|
-
"version": "0.12.0-beta.
|
|
3
|
+
"version": "0.12.0-beta.185",
|
|
4
4
|
"description": "Reporting plugin for forms-angular",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"angular-messages": "1.8.3",
|
|
33
33
|
"angular-mocks": "1.8.3",
|
|
34
34
|
"angular-sanitize": "1.8.3",
|
|
35
|
-
"forms-angular": "0.12.0-beta.
|
|
35
|
+
"forms-angular": "0.12.0-beta.185",
|
|
36
36
|
"grunt": "^1.5.2",
|
|
37
37
|
"grunt-autoprefixer": "3.0.4",
|
|
38
38
|
"grunt-concurrent": "3.0.0",
|
package/src/fng-reports.js
CHANGED
|
@@ -36,26 +36,30 @@ formsAngular.controller('AnalysisCtrl', ['$rootScope', '$window', '$filter', '$s
|
|
|
36
36
|
gridApi.selection.on.rowSelectionChanged($scope, function afterSelectionChange(rowItem) {
|
|
37
37
|
var url = $scope.reportSchema.drilldown;
|
|
38
38
|
if (url) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
if (typeof url === 'string') {
|
|
40
|
+
url = routingService.buildUrl(url.replace(/\|.+?\|/g, function (match) {
|
|
41
|
+
var param = match.slice(1, -1),
|
|
42
|
+
isParamTest = /\((.+)\)/.exec(param);
|
|
43
|
+
if (isParamTest) {
|
|
44
|
+
var instructions = $scope.reportSchema.params[isParamTest[1]];
|
|
45
|
+
if (instructions) {
|
|
46
|
+
$scope.param = $scope.record[isParamTest[1]];
|
|
47
|
+
if (instructions.conversionExpression) {
|
|
48
|
+
return $scope.$eval(instructions.conversionExpression);
|
|
49
|
+
} else {
|
|
50
|
+
return instructions.value;
|
|
51
|
+
}
|
|
48
52
|
} else {
|
|
49
|
-
return
|
|
53
|
+
return $scope.reportSchema.params[isParamTest[1]].value;
|
|
50
54
|
}
|
|
51
55
|
} else {
|
|
52
|
-
return
|
|
56
|
+
return rowItem.entity[param];
|
|
53
57
|
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
}));
|
|
59
|
+
window.location = url;
|
|
60
|
+
} else {
|
|
61
|
+
console.error('Was expecting drilldown to be string but it was ' + typeof url + ' (' + url + ')'); // trying to track down Sentry 3037641567
|
|
62
|
+
}
|
|
59
63
|
}
|
|
60
64
|
});
|
|
61
65
|
},
|