fng-reports 0.12.0-beta.315 → 0.12.0-beta.317
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
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! forms-angular 2025-
|
|
1
|
+
/*! forms-angular 2025-08-06 */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
formsAngular.controller('AnalysisCtrl', ['$rootScope', '$window', '$q', '$filter', '$scope', '$http', '$location', 'CssFrameworkService', 'RoutingService', 'uiGridConstants',
|
|
@@ -190,7 +190,7 @@ ${e.message}`);
|
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
var filter = angular.element(document.body).injector().get('$filter')(filterName.trim());
|
|
193
|
-
filters[col.field] = {filter: filter, filterParam: filterParam};
|
|
193
|
+
filters[col.displayName || col.field] = {filter: filter, filterParam: filterParam};
|
|
194
194
|
}
|
|
195
195
|
};
|
|
196
196
|
|
|
@@ -266,8 +266,12 @@ ${e.message}`);
|
|
|
266
266
|
function toTextValue(obj, conversionExpression) {
|
|
267
267
|
let retVal;
|
|
268
268
|
if (!(obj instanceof Date)) {
|
|
269
|
-
if (typeof obj === 'string'
|
|
270
|
-
|
|
269
|
+
if (typeof obj === 'string') {
|
|
270
|
+
if (obj.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3} \d{4}$/)) {
|
|
271
|
+
obj = new Date(obj.replace(' ', '+'));
|
|
272
|
+
} else if (obj.match(/^\d{13}$/)) {
|
|
273
|
+
obj = new Date(parseInt(obj, 10));
|
|
274
|
+
}
|
|
271
275
|
}
|
|
272
276
|
}
|
|
273
277
|
if (obj instanceof Date) {
|
|
@@ -398,7 +402,7 @@ ${e.message}`);
|
|
|
398
402
|
$scope.gridOptions.showColumnFooter = true;
|
|
399
403
|
colDef.aggregationType = uiGridConstants.aggregationTypes[colDef.aggregationTypeStr];
|
|
400
404
|
if (!colDef.aggregationType) {
|
|
401
|
-
colDef.aggregationType = function() {return eval(colDef.aggregationTypeStr)};
|
|
405
|
+
colDef.aggregationType = function() {return eval(colDef.aggregationTypeStr);};
|
|
402
406
|
}
|
|
403
407
|
colDef.aggregationHideLabel = colDef.aggregationTypeStr === 'sum';
|
|
404
408
|
colDef.footerCellFilter = colDef.cellFilter;
|
|
@@ -685,7 +689,7 @@ function ngGridCsvExportPlugin(opts) {
|
|
|
685
689
|
if (typeof col.doCSVExport === 'function') {
|
|
686
690
|
value = col.doCSVExport(value, row.entity, col);
|
|
687
691
|
}
|
|
688
|
-
csvData += '"' + csvStringify(value, filters[col.field]) + '",';
|
|
692
|
+
csvData += '"' + csvStringify(value, filters[col.displayName || col.field]) + '",';
|
|
689
693
|
}
|
|
690
694
|
});
|
|
691
695
|
csvData = swapLastCommaForNewline(csvData);
|
|
@@ -734,8 +738,7 @@ function ngGridPdfExportPlugin(options) {
|
|
|
734
738
|
};
|
|
735
739
|
|
|
736
740
|
self.createPDF = function () {
|
|
737
|
-
var
|
|
738
|
-
headerNames = [],
|
|
741
|
+
var headerInfo = [],
|
|
739
742
|
footers = [],
|
|
740
743
|
data = [],
|
|
741
744
|
filters = {},
|
|
@@ -748,13 +751,11 @@ function ngGridPdfExportPlugin(options) {
|
|
|
748
751
|
console.error(`Cannot export nested fields such as ${col.field}. Use $project to simplify.`);
|
|
749
752
|
} else {
|
|
750
753
|
if (!col.colDef || !col.colDef.cellTemplate) {
|
|
751
|
-
|
|
752
|
-
headerNames.push(col.field);
|
|
754
|
+
headerInfo.push({d: col.displayName, f: col.field});
|
|
753
755
|
} else {
|
|
754
756
|
const templateResp = self.scope.showsContent(col.colDef.cellTemplate, col.field);
|
|
755
757
|
if (templateResp === 'HTML') {
|
|
756
|
-
|
|
757
|
-
headerNames.push(col.field);
|
|
758
|
+
headerInfo.push({d: col.displayName, f: col.field});
|
|
758
759
|
transformers[col.field] = function (value) {
|
|
759
760
|
value = value.replace(/<p>/g, '\n\n');
|
|
760
761
|
value = value.replace(/<\/p>/g, '');
|
|
@@ -766,8 +767,7 @@ function ngGridPdfExportPlugin(options) {
|
|
|
766
767
|
return value;
|
|
767
768
|
};
|
|
768
769
|
} else if (templateResp) {
|
|
769
|
-
|
|
770
|
-
headerNames.push(col.field);
|
|
770
|
+
headerInfo.push({d: col.displayName, f: col.field});
|
|
771
771
|
}
|
|
772
772
|
}
|
|
773
773
|
}
|
|
@@ -781,13 +781,13 @@ function ngGridPdfExportPlugin(options) {
|
|
|
781
781
|
angular.forEach(self.scope.gridApi.core.getVisibleRows(), function (row) {
|
|
782
782
|
var output = [];
|
|
783
783
|
if (row.visible) {
|
|
784
|
-
|
|
785
|
-
var val = row.entity[h];
|
|
786
|
-
if (filters[h]) {
|
|
787
|
-
val = filters[h].filter(val, filters[h].filterParam);
|
|
784
|
+
headerInfo.forEach(function(h) {
|
|
785
|
+
var val = row.entity[h.f];
|
|
786
|
+
if (filters[h.d]) {
|
|
787
|
+
val = filters[h.d].filter(val, filters[h.d].filterParam);
|
|
788
788
|
}
|
|
789
|
-
if (transformers[h]) {
|
|
790
|
-
val = transformers[h](val);
|
|
789
|
+
if (transformers[h.f]) {
|
|
790
|
+
val = transformers[h.f](val);
|
|
791
791
|
}
|
|
792
792
|
if (typeof val === 'string') {
|
|
793
793
|
// chars > 255 cause BOM characters - see https://reallycare.freshdesk.com/a/tickets/2370
|
|
@@ -809,7 +809,7 @@ function ngGridPdfExportPlugin(options) {
|
|
|
809
809
|
// var doc = new jsPDF('landscape', 'mm', 'a4');
|
|
810
810
|
var doc = new jspdf.jsPDF('landscape', 'mm', 'a4');
|
|
811
811
|
doc.autoTable({
|
|
812
|
-
head: [
|
|
812
|
+
head: [headerInfo.map(h => h.d)],
|
|
813
813
|
body: data
|
|
814
814
|
});
|
|
815
815
|
|
package/dist/fng-reports.min.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! forms-angular 2025-
|
|
2
|
-
|
|
3
|
-
`+e.message)}}if(angular.extend($scope,RoutingService.parsePathFunc()($location.$$path)),$scope.reportSchema={},$scope.gridOptions={enableFiltering:!1,data:"report",columnDefs:$scope.reportSchema.columnDefs,showColumnMenu:!0,enableRowHeaderSelection:!1,reallyShowFooter:!1,showTotals:!0,enableColumnResizing:!0,footerRowHeight:65,multiSelect:!1,plugins:[pdfPlugIn,csvPlugIn],onRegisterApi:function(r){$scope.gridApi=r,$scope.gridOptions.plugins.forEach(function(e){e.init($scope,r.grid,null)}),r.selection.on.rowSelectionChanged($scope,function(t,o){var a=$scope.reportSchema.drilldown;if(a)if("string"==typeof a){let e="A"===o.target.tagName,r=o.target;for(;r=r.parentElement,e=r&&"A"===r.tagName,r&&!e&&r!==t;);e||(a=RoutingService.buildUrl(a.replace(/\|.+?\|/g,function(e){var r,e=e.slice(1,-1),o=/\((.+)\)/.exec(e);return o?(r=$scope.reportSchema.params[o[1]])&&$scope.record?($scope.param=$scope.record[o[1]],r.conversionExpression?$scope.$eval(r.conversionExpression):r.value):$scope.reportSchema.params[o[1]]?$scope.reportSchema.params[o[1]].value||"":(console.error("No value for "+o[1]),"ERR"):t.entity[e]})),window.location=a)}else console.error("Was expecting drilldown to be string but it was "+typeof a+" ("+a+")")})},appScopeProvider:{http:function(r,e,o){r.currentTarget.getAttributeNames().forEach(e=>{e.startsWith("data-")&&(o=o.replace(":"+e.slice(5),r.currentTarget.getAttribute(e)))});var t=r.currentTarget.getAttribute("data-disable-button"),t=(t&&(r.currentTarget.setAttribute("disabled","disabled"),"true"!==t)&&(r.currentTarget.innerText=t),{method:e,url:o});-1!==["POST","PUT","PATCH"].indexOf(e)&&(t.data={val:r.currentTarget.getAttribute("data-data")||{}}),$http(t).then(function(e){200!==e.status&&$scope.showError(e.statusText,"Error")}),r.stopPropagation()}}},$scope.report=[],!$scope.reportSchemaName&&$location.$$search.r)switch($location.$$search.r.slice(0,1)){case"[":$scope.reportSchema.pipeline=parseAndHandleError($location.$$search.r);break;case"{":angular.extend($scope.reportSchema,parseAndHandleError($location.$$search.r));break;default:throw new Error("No report instructions specified")}function setupParamsForm(e){for(var r in $scope.paramSchema=[],$scope.record={},e){var o,t;e.hasOwnProperty(r)&&((o=e[r]).noInput||(t=$scope.paramSchema.push({name:r,id:"fp_"+r,label:o.label||$filter("titleCase")(r),type:o.type||"text",required:!0,add:o.add||void 0,size:o.size||("bs3"===CssFrameworkService.frameWork?"large":"medium")}),"select"===o.type&&($scope[r+"_Opts"]=o.enum,$scope.paramSchema[t-1].options=r+"_Opts")),(t=/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3})(Z|[+ -]\d{4})$/.exec(o.value))&&(o.value=new Date(t[0])),$scope.record[r]=o.value)}$scope.$watch("record",function(e,r){r!==e&&$scope.refreshQuery()},!0)}$scope.getTotalVal=function(r,e){var o="",t=_.find($scope.reportSchema.columnDefs,function(e){return e.field===r});if(t)switch(t.totalsRow){case void 0:break;case"$SUM":for(var a=0,n=0;n<$scope.report.length;n++)a+=$scope.report[n][r];o=a,e&&(o=$filter(e)(o));break;default:o=t.totalsRow}return o},$scope.$on("exportToPDF",function(){pdfPlugIn.createPDF()}),$scope.$on("exportToCSV",function(){csvPlugIn.createCSV()}),$scope.extractFilter=function(e,r){var o,t,a;e.cellFilter&&(-1===(a=e.cellFilter.indexOf(":"))?o=e.cellFilter:(o=e.cellFilter.slice(0,a).trim(),"'"!==(t=e.cellFilter.slice(a+1,999).trim())[0]&&'"'!==t[0]||(t=t.slice(1,-1))),a=angular.element(document.body).injector().get("$filter")(o.trim()),r[e.field]={filter:a,filterParam:t})};var container=document.querySelector("div.report-grow"),margin,topOffset,header,headerHeight,availRows,navScope=(container&&(margin=container.offsetLeft,topOffset=container.offsetTop+margin,header=document.querySelector("div.ui-grid-header"),headerHeight=header?header.clientHeight:31,availRows=Math.floor(($window.innerHeight-topOffset-headerHeight-margin)/30),angular.element(container).css("height",30*availRows+"px")),$rootScope.navScope);navScope.items=[{fn:pdfPlugIn.createPDF,text:"Save as PDF"},{fn:csvPlugIn.createCSV,text:"Export as CSV"}],navScope.contextMenu="Report",navScope.contextMenuId="reportMenu",$scope.titleWithSubstitutions=$scope.reportSchema.title,$scope.inhibitRefresh||($scope.refreshQuery=function(){function substituteParams(t){function c(e,r){let o;return e instanceof Date||"string"==typeof e&&e.match(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3} \d{4}/)&&(e=new Date(e.replace(" ","+"))),e instanceof Date?o=r?($scope.param=e,$scope.$eval(r)):e.toISOString():e}return $q(function(e){let s=[];t.replace(/\|.+?\|/g,function(e){var r=e.slice(1,-1),o=/(.*)\((.+)\)/.exec(r);let t;if(o)try{var a=$scope.reportSchema.params[o[2]],n=a.value;(t=2<o.length&&""!==o[1]?$http.get(`/api/${o[1]}/${n}/list`).then(function(e){return e&&200===e.status&&e.data?e.data.list:""}):t)?s.push(t):s.push(Promise.resolve(c(n,a.conversionExpression)))}catch(e){console.error(e),s.push("Error in fng-reports: "+e.message)}else{o=$scope.reportSchema.params[r];o?s.push(Promise.resolve(c(o.value,o.conversionExpression))):(console.log("Cannot find param "+r),s.push(Promise.resolve("ERR")))}return e}),Promise.all(s).then(function(r){let o=0;e(t.replace(/\|.+?\|/g,function(){var e=r[o];return o+=1,e}))})})}var apiCall="/api/report/"+$scope.modelName,connector="?",haveUrlParams=!1,query=$location.$$url.match(/\?.*/);if($scope.reportSchemaName?apiCall+="/"+$scope.reportSchemaName:query&&(firstTime&&($scope.paramSchema=JSON.parse($location.search().r).params,setupParamsForm($scope.paramSchema)),apiCall+=connector+query[0].slice(1),connector="&",haveUrlParams=!0),$scope.paramSchema){for(var paramVal in $scope.record)if($scope.record.hasOwnProperty(paramVal)){var instructions=$scope.reportSchema.params[paramVal];if($scope.record[paramVal]&&""!==$scope.record[paramVal])$scope.param=$scope.record[paramVal],instructions.conversionExpression&&($scope.param=$scope.$eval(instructions.conversionExpression)),apiCall+=connector+paramVal+"="+$scope.param,connector="&";else if(instructions.required)return}}else!haveUrlParams&&query&&(apiCall+=connector+query[0].slice(1),connector="&");return $http.get(apiCall).then(function(response){if(response&&response.data&&response.data.success){var data=response.data,alignClass;if($scope.report=data.report,$scope.reportSchema=data.schema,firstTime){if(firstTime=!1,data.schema.columnDefs&&0<data.schema.columnDefs.length)for(const colDef of data.schema.columnDefs){colDef.align&&(alignClass="fng-"+colDef.align,colDef.cellClass=colDef.cellClass||"",-1===colDef.cellClass.indexOf(alignClass))&&(colDef.cellClass=colDef.cellClass+" "+alignClass),colDef.aggregationTypeStr&&($scope.gridOptions.showColumnFooter=!0,colDef.aggregationType=uiGridConstants.aggregationTypes[colDef.aggregationTypeStr],colDef.aggregationType||(colDef.aggregationType=function(){return eval(colDef.aggregationTypeStr)}),colDef.aggregationHideLabel="sum"===colDef.aggregationTypeStr,colDef.footerCellFilter=colDef.cellFilter,colDef.footerCellClass=colDef.cellClass),$scope.gridOptions.columnDefs.push(colDef),colDef.width&&"string"==typeof colDef.width&&-1!==colDef.width.indexOf("px")&&(colDef.width=parseInt(colDef.width.slice(0,-2)))}else{var allFields=new Set;data.report.forEach(function(e){for(var r in e)allFields.add(r)}),data.schema.columnDefs=Array.from(allFields).map(function(e){e={name:e};return $scope.gridOptions.columnDefs.push(e),e})}!$scope.paramSchema&&data.schema.params&&"1"!==$location.$$search.noinput&&setupParamsForm(data.schema.params)}$scope.reportSchema.title=$scope.reportSchema.title||$scope.modelName,substituteParams($scope.reportSchema.title).then(function(e){$scope.titleWithSubstitutions=e}),$scope.gridOptions.enableFiltering=!!$scope.reportSchema.filter,navScope&&navScope.items&&(navScope.items.length=2,$scope.reportSchema.menu)&&$scope.reportSchema.menu.forEach(function(e){substituteParams(JSON.stringify(e)).then(function(e){navScope.items.push(JSON.parse(e))})})}else $scope.showError(JSON.stringify(response.data.error),"Invalid Response Error"),$scope.reportSchema.title="Error - see console log"},function(e){let r,o;o=403===e.status?(r="You do not have permission to run this report (permission to GET all "+$scope.modelName+" records is required)","Permission denied"):(r="The server could not process the request<br />Details:<br />"+e.data,"Error"),$scope.showError(r,o)})},$scope.refreshQuery()),$scope.showsContent=function(e,r){return!!/{{[\s]*COL_FIELD[\s]*}}/.test(e.replace(/(<([^>]+)>)/gi,""))||(-1!==e.indexOf('ng-bind-html="row.entity.'+r)?"HTML":void 0)},$scope.$on("$locationChangeStart",function(){navScope.clearContextMenu()}),$scope.showError=function(r,e){if($scope.alertTitle=e||"Error!","string"==typeof r)$scope.errorMessage=r;else if(r)if(r.message&&"string"==typeof r.message)$scope.errorMessage=r.message;else if(r.data&&r.data.message)$scope.errorMessage=r.data.message;else try{$scope.errorMessage=JSON.stringify(r)}catch(e){$scope.errorMessage=r}else $scope.errorMessage="An error occurred - that's all we got. Sorry.";$scope.errorHideTimer=window.setTimeout(function(){$scope.dismissError(),$scope.$digest()},3500+1e3*($scope.alertTitle+$scope.errorMessage).length/50),$scope.errorVisible=!0,window.setTimeout(()=>{$scope.$digest()})},$scope.clearTimeout=function(){$scope.errorHideTimer&&(clearTimeout($scope.errorHideTimer),delete $scope.errorHideTimer)},$scope.dismissError=function(){$scope.clearTimeout,$scope.errorVisible=!1,delete $scope.errorMessage,delete $scope.alertTitle},$scope.stickError=function(){clearTimeout($scope.errorHideTimer)}}]);var COL_FIELD=/COL_FIELD/g;function ngGridCsvExportPlugin(e){var s=this;s.grid=null,s.scope=null,s.services=null,s.init=function(e,r,o){s.grid=r,s.scope=e,s.services=o},s.createCSV=function(){var e,r,o;e=(s.scope.titleWithSubstitutions||s.scope.reportSchema.title)+".csv",r="data:text/csv;charset=UTF-8,"+encodeURIComponent(s.prepareCSV()),(o=document.createElement("a")).download=e,o.href=r,e=new MouseEvent("click"),o.dispatchEvent(e)},s.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 a="",n={};return angular.forEach(s.grid.columns,function(e){var r;s.scope.extractFilter(e,n),e.visible&&(void 0===e.width||"*"===e.width||0<e.width)&&(-1!==e.field.indexOf(".")?console.error(`Cannot export nested fields such as ${e.field}. Use $project to simplify.`):e.colDef&&e.colDef.cellTemplate?"function"==typeof(r=s.scope.showsContent(e.colDef.cellTemplate,e.field))?(a+='"'+t(e.displayName)+'",',e.doCSVExport=r):"HTML"===r?(a+='"'+t(e.displayName)+'",',e.doCSVExport=function(e){return e=(e=(e=(e=(e=(e=(e=e.replace(/<p>/g,"\n\n")).replace(/<\/p>/g,"")).replace(/<\s?br\s?\/?>/g,"\n")).replace(/<[^>]+>/g,"")).replaceAll(" "," ").trim()).replaceAll("\n\n \n\n","\n\n")).replaceAll("\n\n\n","\n\n")}):r?(a+='"'+t(e.displayName)+'",',e.doCSVExport=!0):e.doCSVExport=!1:(a+='"'+t(e.displayName)+'",',e.doCSVExport=!0))}),a=e(a),angular.forEach(s.scope.gridApi.core.getVisibleRows(),function(o){o.visible&&(angular.forEach(s.grid.columns,function(r){if(r.doCSVExport){let e=o.entity[r.field];"function"==typeof r.doCSVExport&&(e=r.doCSVExport(e,o.entity,r)),a+='"'+t(e,n[r.field])+'",'}}),a=e(a))}),a}}function ngGridPdfExportPlugin(t){var c=this;c.grid=null,c.scope=null,c.services=null,c.options=t,c.init=function(e,r,o){c.grid=r,c.scope=e,c.services=o,t.inhibitButton||(e=r.$root.find(".ngFooterPanel"),null!=(o=r.$root.find(".ngFooterPanel .pdf-data-link-span"))&&o.remove(),e.append('<button class="pdf-data-link-span">PDF Export</button>'),e.on("click",function(){c.createPDF()}))},c.createPDF=function(){var o=[],a=[],e=[],n={},s={},r=(angular.forEach(c.grid.columns,function(e){var r;e.visible&&(-1!==e.field.indexOf(".")?console.error(`Cannot export nested fields such as ${e.field}. Use $project to simplify.`):e.colDef&&e.colDef.cellTemplate?"HTML"===(r=c.scope.showsContent(e.colDef.cellTemplate,e.field))?(o.push(e.displayName),a.push(e.field),s[e.field]=function(e){return e=(e=(e=(e=(e=(e=(e=e.replace(/<p>/g,"\n\n")).replace(/<\/p>/g,"")).replace(/<\s?br\s?\/?>/g,"\n")).replace(/<[^>]+>/g,"")).replaceAll(" "," ").trim()).replaceAll("\n\n \n\n","\n\n")).replaceAll("\n\n\n","\n\n")}):r&&(o.push(e.displayName),a.push(e.field)):(o.push(e.displayName),a.push(e.field))),e.colDef&&e.colDef.totalsRow&&(e.field,c.grid.getTotalVal(e.field,e.filter).toString()),c.scope.extractFilter(e,n)}),angular.forEach(c.scope.gridApi.core.getVisibleRows(),function(o){var t=[];o.visible&&(a.forEach(function(e){var r=o.entity[e];n[e]&&(r=n[e].filter(r,n[e].filterParam)),"string"==typeof(r=s[e]?s[e](r):r)&&(r=(r=(r=(r=(r=r.replace(/\u2019/g,"'")).replace(/\u2018/g,"'")).replace(/\u201c/g,'"')).replace(/\u201d/g,'"')).replace(/[^\x00-\xFF]/g,"")),t.push(r)}),e.push(t))}),new jspdf.jsPDF("landscape","mm","a4"));r.autoTable({head:[o],body:e}),window.open(r.output("bloburl"))}}formsAngular.directive("ngTotalCell",["$compile","$domUtilityService",function(a,o){return{scope:!1,compile:function(){return{pre:function(e,r){var o=e.col.cellTemplate.match(/{{COL_FIELD \|(.+)}}/),o=o?e.col.cellTemplate.replace("COL_FIELD |"+o[1],'getTotalVal("'+e.col.field+'","'+o[1]+'")'):e.col.cellTemplate.replace(COL_FIELD,'getTotalVal("'+e.col.field+'")'),t=e.col.enableCellEdit?(t=(t=e.col.cellEditTemplate).replace(DISPLAY_CELL_TEMPLATE,o)).replace(EDITABLE_CELL_TEMPLATE,e.col.editableCellTemplate.replace(COL_FIELD,"row.entity."+e.col.field)):o,o=a(t)(e);e.enableCellSelection&&-1===o[0].className.indexOf("ngSelectionCell")&&(o[0].setAttribute("tabindex",0),o.addClass("ngCellElement")),r.append(o)},post:function(e,r){e.enableCellSelection&&e.domAccessProvider.selectionHandlers(e,r),e.$on("ngGridEventDigestCell",function(){o.digest(e)})}}}}}]);
|
|
1
|
+
/*! forms-angular 2025-08-06 */
|
|
2
|
+
formsAngular.controller("AnalysisCtrl",["$rootScope","$window","$q","$filter","$scope","$http","$location","CssFrameworkService","RoutingService","uiGridConstants",function($rootScope,$window,$q,$filter,$scope,$http,$location,CssFrameworkService,RoutingService,uiGridConstants){var firstTime=!0,pdfPlugIn=new ngGridPdfExportPlugin({inhibitButton:!0}),csvPlugIn=new ngGridCsvExportPlugin({inhibitButton:!0});function parseAndHandleError(r){try{return JSON.parse(r)}catch(e){throw new Error(`Invalid JSON ${r}
|
|
3
|
+
`+e.message)}}if(angular.extend($scope,RoutingService.parsePathFunc()($location.$$path)),$scope.reportSchema={},$scope.gridOptions={enableFiltering:!1,data:"report",columnDefs:$scope.reportSchema.columnDefs,showColumnMenu:!0,enableRowHeaderSelection:!1,reallyShowFooter:!1,showTotals:!0,enableColumnResizing:!0,footerRowHeight:65,multiSelect:!1,plugins:[pdfPlugIn,csvPlugIn],onRegisterApi:function(r){$scope.gridApi=r,$scope.gridOptions.plugins.forEach(function(e){e.init($scope,r.grid,null)}),r.selection.on.rowSelectionChanged($scope,function(t,o){var a=$scope.reportSchema.drilldown;if(a)if("string"==typeof a){let e="A"===o.target.tagName,r=o.target;for(;r=r.parentElement,e=r&&"A"===r.tagName,r&&!e&&r!==t;);e||(a=RoutingService.buildUrl(a.replace(/\|.+?\|/g,function(e){var r,e=e.slice(1,-1),o=/\((.+)\)/.exec(e);return o?(r=$scope.reportSchema.params[o[1]])&&$scope.record?($scope.param=$scope.record[o[1]],r.conversionExpression?$scope.$eval(r.conversionExpression):r.value):$scope.reportSchema.params[o[1]]?$scope.reportSchema.params[o[1]].value||"":(console.error("No value for "+o[1]),"ERR"):t.entity[e]})),window.location=a)}else console.error("Was expecting drilldown to be string but it was "+typeof a+" ("+a+")")})},appScopeProvider:{http:function(r,e,o){r.currentTarget.getAttributeNames().forEach(e=>{e.startsWith("data-")&&(o=o.replace(":"+e.slice(5),r.currentTarget.getAttribute(e)))});var t=r.currentTarget.getAttribute("data-disable-button"),t=(t&&(r.currentTarget.setAttribute("disabled","disabled"),"true"!==t)&&(r.currentTarget.innerText=t),{method:e,url:o});-1!==["POST","PUT","PATCH"].indexOf(e)&&(t.data={val:r.currentTarget.getAttribute("data-data")||{}}),$http(t).then(function(e){200!==e.status&&$scope.showError(e.statusText,"Error")}),r.stopPropagation()}}},$scope.report=[],!$scope.reportSchemaName&&$location.$$search.r)switch($location.$$search.r.slice(0,1)){case"[":$scope.reportSchema.pipeline=parseAndHandleError($location.$$search.r);break;case"{":angular.extend($scope.reportSchema,parseAndHandleError($location.$$search.r));break;default:throw new Error("No report instructions specified")}function setupParamsForm(e){for(var r in $scope.paramSchema=[],$scope.record={},e){var o,t;e.hasOwnProperty(r)&&((o=e[r]).noInput||(t=$scope.paramSchema.push({name:r,id:"fp_"+r,label:o.label||$filter("titleCase")(r),type:o.type||"text",required:!0,add:o.add||void 0,size:o.size||("bs3"===CssFrameworkService.frameWork?"large":"medium")}),"select"===o.type&&($scope[r+"_Opts"]=o.enum,$scope.paramSchema[t-1].options=r+"_Opts")),(t=/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3})(Z|[+ -]\d{4})$/.exec(o.value))&&(o.value=new Date(t[0])),$scope.record[r]=o.value)}$scope.$watch("record",function(e,r){r!==e&&$scope.refreshQuery()},!0)}$scope.getTotalVal=function(r,e){var o="",t=_.find($scope.reportSchema.columnDefs,function(e){return e.field===r});if(t)switch(t.totalsRow){case void 0:break;case"$SUM":for(var a=0,n=0;n<$scope.report.length;n++)a+=$scope.report[n][r];o=a,e&&(o=$filter(e)(o));break;default:o=t.totalsRow}return o},$scope.$on("exportToPDF",function(){pdfPlugIn.createPDF()}),$scope.$on("exportToCSV",function(){csvPlugIn.createCSV()}),$scope.extractFilter=function(e,r){var o,t,a;e.cellFilter&&(-1===(a=e.cellFilter.indexOf(":"))?o=e.cellFilter:(o=e.cellFilter.slice(0,a).trim(),"'"!==(t=e.cellFilter.slice(a+1,999).trim())[0]&&'"'!==t[0]||(t=t.slice(1,-1))),a=angular.element(document.body).injector().get("$filter")(o.trim()),r[e.displayName||e.field]={filter:a,filterParam:t})};var container=document.querySelector("div.report-grow"),margin,topOffset,header,headerHeight,availRows,navScope=(container&&(margin=container.offsetLeft,topOffset=container.offsetTop+margin,header=document.querySelector("div.ui-grid-header"),headerHeight=header?header.clientHeight:31,availRows=Math.floor(($window.innerHeight-topOffset-headerHeight-margin)/30),angular.element(container).css("height",30*availRows+"px")),$rootScope.navScope);navScope.items=[{fn:pdfPlugIn.createPDF,text:"Save as PDF"},{fn:csvPlugIn.createCSV,text:"Export as CSV"}],navScope.contextMenu="Report",navScope.contextMenuId="reportMenu",$scope.titleWithSubstitutions=$scope.reportSchema.title,$scope.inhibitRefresh||($scope.refreshQuery=function(){function substituteParams(t){function c(e,r){let o;return e instanceof Date||"string"==typeof e&&(e.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3} \d{4}$/)?e=new Date(e.replace(" ","+")):e.match(/^\d{13}$/)&&(e=new Date(parseInt(e,10)))),e instanceof Date?o=r?($scope.param=e,$scope.$eval(r)):e.toISOString():e}return $q(function(e){let s=[];t.replace(/\|.+?\|/g,function(e){let r=e.slice(1,-1),o=/(.*)\((.+)\)/.exec(r),t;if(o)try{var a=$scope.reportSchema.params[o[2]],n=a.value;(t=2<o.length&&""!==o[1]?$http.get(`/api/${o[1]}/${n}/list`).then(function(e){return e&&200===e.status&&e.data?e.data.list:""}):t)?s.push(t):s.push(Promise.resolve(c(n,a.conversionExpression)))}catch(e){console.error(e),s.push("Error in fng-reports: "+e.message)}else{n=$scope.reportSchema.params[r];n?s.push(Promise.resolve(c(n.value,n.conversionExpression))):(console.log("Cannot find param "+r),s.push(Promise.resolve("ERR")))}return e}),Promise.all(s).then(function(r){let o=0;e(t.replace(/\|.+?\|/g,function(){var e=r[o];return o+=1,e}))})})}var apiCall="/api/report/"+$scope.modelName,connector="?",haveUrlParams=!1,query=$location.$$url.match(/\?.*/);if($scope.reportSchemaName?apiCall+="/"+$scope.reportSchemaName:query&&(firstTime&&($scope.paramSchema=JSON.parse($location.search().r).params,setupParamsForm($scope.paramSchema)),apiCall+=connector+query[0].slice(1),connector="&",haveUrlParams=!0),$scope.paramSchema){for(var paramVal in $scope.record)if($scope.record.hasOwnProperty(paramVal)){var instructions=$scope.reportSchema.params[paramVal];if($scope.record[paramVal]&&""!==$scope.record[paramVal])$scope.param=$scope.record[paramVal],instructions.conversionExpression&&($scope.param=$scope.$eval(instructions.conversionExpression)),apiCall+=connector+paramVal+"="+$scope.param,connector="&";else if(instructions.required)return}}else!haveUrlParams&&query&&(apiCall+=connector+query[0].slice(1),connector="&");return $http.get(apiCall).then(function(response){if(response&&response.data&&response.data.success){var data=response.data,alignClass;if($scope.report=data.report,$scope.reportSchema=data.schema,firstTime){if(firstTime=!1,data.schema.columnDefs&&0<data.schema.columnDefs.length)for(let colDef of data.schema.columnDefs){colDef.align&&(alignClass="fng-"+colDef.align,colDef.cellClass=colDef.cellClass||"",-1===colDef.cellClass.indexOf(alignClass))&&(colDef.cellClass=colDef.cellClass+" "+alignClass),colDef.aggregationTypeStr&&($scope.gridOptions.showColumnFooter=!0,colDef.aggregationType=uiGridConstants.aggregationTypes[colDef.aggregationTypeStr],colDef.aggregationType||(colDef.aggregationType=function(){return eval(colDef.aggregationTypeStr)}),colDef.aggregationHideLabel="sum"===colDef.aggregationTypeStr,colDef.footerCellFilter=colDef.cellFilter,colDef.footerCellClass=colDef.cellClass),$scope.gridOptions.columnDefs.push(colDef),colDef.width&&"string"==typeof colDef.width&&-1!==colDef.width.indexOf("px")&&(colDef.width=parseInt(colDef.width.slice(0,-2)))}else{var allFields=new Set;data.report.forEach(function(e){for(var r in e)allFields.add(r)}),data.schema.columnDefs=Array.from(allFields).map(function(e){e={name:e};return $scope.gridOptions.columnDefs.push(e),e})}!$scope.paramSchema&&data.schema.params&&"1"!==$location.$$search.noinput&&setupParamsForm(data.schema.params)}$scope.reportSchema.title=$scope.reportSchema.title||$scope.modelName,substituteParams($scope.reportSchema.title).then(function(e){$scope.titleWithSubstitutions=e}),$scope.gridOptions.enableFiltering=!!$scope.reportSchema.filter,navScope&&navScope.items&&(navScope.items.length=2,$scope.reportSchema.menu)&&$scope.reportSchema.menu.forEach(function(e){substituteParams(JSON.stringify(e)).then(function(e){navScope.items.push(JSON.parse(e))})})}else $scope.showError(JSON.stringify(response.data.error),"Invalid Response Error"),$scope.reportSchema.title="Error - see console log"},function(e){let r,o;o=403===e.status?(r="You do not have permission to run this report (permission to GET all "+$scope.modelName+" records is required)","Permission denied"):(r="The server could not process the request<br />Details:<br />"+e.data,"Error"),$scope.showError(r,o)})},$scope.refreshQuery()),$scope.showsContent=function(e,r){return!!/{{[\s]*COL_FIELD[\s]*}}/.test(e.replace(/(<([^>]+)>)/gi,""))||(-1!==e.indexOf('ng-bind-html="row.entity.'+r)?"HTML":void 0)},$scope.$on("$locationChangeStart",function(){navScope.clearContextMenu()}),$scope.showError=function(r,e){if($scope.alertTitle=e||"Error!","string"==typeof r)$scope.errorMessage=r;else if(r)if(r.message&&"string"==typeof r.message)$scope.errorMessage=r.message;else if(r.data&&r.data.message)$scope.errorMessage=r.data.message;else try{$scope.errorMessage=JSON.stringify(r)}catch(e){$scope.errorMessage=r}else $scope.errorMessage="An error occurred - that's all we got. Sorry.";$scope.errorHideTimer=window.setTimeout(function(){$scope.dismissError(),$scope.$digest()},3500+1e3*($scope.alertTitle+$scope.errorMessage).length/50),$scope.errorVisible=!0,window.setTimeout(()=>{$scope.$digest()})},$scope.clearTimeout=function(){$scope.errorHideTimer&&(clearTimeout($scope.errorHideTimer),delete $scope.errorHideTimer)},$scope.dismissError=function(){$scope.clearTimeout,$scope.errorVisible=!1,delete $scope.errorMessage,delete $scope.alertTitle},$scope.stickError=function(){clearTimeout($scope.errorHideTimer)}}]);var COL_FIELD=/COL_FIELD/g;function ngGridCsvExportPlugin(e){var s=this;s.grid=null,s.scope=null,s.services=null,s.init=function(e,r,o){s.grid=r,s.scope=e,s.services=o},s.createCSV=function(){var e,r,o;e=(s.scope.titleWithSubstitutions||s.scope.reportSchema.title)+".csv",r="data:text/csv;charset=UTF-8,"+encodeURIComponent(s.prepareCSV()),(o=document.createElement("a")).download=e,o.href=r,e=new MouseEvent("click"),o.dispatchEvent(e)},s.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 a="",n={};return angular.forEach(s.grid.columns,function(e){var r;s.scope.extractFilter(e,n),e.visible&&(void 0===e.width||"*"===e.width||0<e.width)&&(-1!==e.field.indexOf(".")?console.error(`Cannot export nested fields such as ${e.field}. Use $project to simplify.`):e.colDef&&e.colDef.cellTemplate?"function"==typeof(r=s.scope.showsContent(e.colDef.cellTemplate,e.field))?(a+='"'+t(e.displayName)+'",',e.doCSVExport=r):"HTML"===r?(a+='"'+t(e.displayName)+'",',e.doCSVExport=function(e){return e=(e=(e=(e=(e=(e=(e=e.replace(/<p>/g,"\n\n")).replace(/<\/p>/g,"")).replace(/<\s?br\s?\/?>/g,"\n")).replace(/<[^>]+>/g,"")).replaceAll(" "," ").trim()).replaceAll("\n\n \n\n","\n\n")).replaceAll("\n\n\n","\n\n")}):r?(a+='"'+t(e.displayName)+'",',e.doCSVExport=!0):e.doCSVExport=!1:(a+='"'+t(e.displayName)+'",',e.doCSVExport=!0))}),a=e(a),angular.forEach(s.scope.gridApi.core.getVisibleRows(),function(o){o.visible&&(angular.forEach(s.grid.columns,function(r){if(r.doCSVExport){let e=o.entity[r.field];"function"==typeof r.doCSVExport&&(e=r.doCSVExport(e,o.entity,r)),a+='"'+t(e,n[r.displayName||r.field])+'",'}}),a=e(a))}),a}}function ngGridPdfExportPlugin(t){var c=this;c.grid=null,c.scope=null,c.services=null,c.options=t,c.init=function(e,r,o){c.grid=r,c.scope=e,c.services=o,t.inhibitButton||(e=r.$root.find(".ngFooterPanel"),null!=(o=r.$root.find(".ngFooterPanel .pdf-data-link-span"))&&o.remove(),e.append('<button class="pdf-data-link-span">PDF Export</button>'),e.on("click",function(){c.createPDF()}))},c.createPDF=function(){var a=[],e=[],n={},s={},r=(angular.forEach(c.grid.columns,function(e){var r;e.visible&&(-1!==e.field.indexOf(".")?console.error(`Cannot export nested fields such as ${e.field}. Use $project to simplify.`):e.colDef&&e.colDef.cellTemplate?"HTML"===(r=c.scope.showsContent(e.colDef.cellTemplate,e.field))?(a.push({d:e.displayName,f:e.field}),s[e.field]=function(e){return e=(e=(e=(e=(e=(e=(e=e.replace(/<p>/g,"\n\n")).replace(/<\/p>/g,"")).replace(/<\s?br\s?\/?>/g,"\n")).replace(/<[^>]+>/g,"")).replaceAll(" "," ").trim()).replaceAll("\n\n \n\n","\n\n")).replaceAll("\n\n\n","\n\n")}):r&&a.push({d:e.displayName,f:e.field}):a.push({d:e.displayName,f:e.field})),e.colDef&&e.colDef.totalsRow&&(e.field,c.grid.getTotalVal(e.field,e.filter).toString()),c.scope.extractFilter(e,n)}),angular.forEach(c.scope.gridApi.core.getVisibleRows(),function(o){var t=[];o.visible&&(a.forEach(function(e){var r=o.entity[e.f];n[e.d]&&(r=n[e.d].filter(r,n[e.d].filterParam)),"string"==typeof(r=s[e.f]?s[e.f](r):r)&&(r=(r=(r=(r=(r=r.replace(/\u2019/g,"'")).replace(/\u2018/g,"'")).replace(/\u201c/g,'"')).replace(/\u201d/g,'"')).replace(/[^\x00-\xFF]/g,"")),t.push(r)}),e.push(t))}),new jspdf.jsPDF("landscape","mm","a4"));r.autoTable({head:[a.map(e=>e.d)],body:e}),window.open(r.output("bloburl"))}}formsAngular.directive("ngTotalCell",["$compile","$domUtilityService",function(a,o){return{scope:!1,compile:function(){return{pre:function(e,r){var o=e.col.cellTemplate.match(/{{COL_FIELD \|(.+)}}/),o=o?e.col.cellTemplate.replace("COL_FIELD |"+o[1],'getTotalVal("'+e.col.field+'","'+o[1]+'")'):e.col.cellTemplate.replace(COL_FIELD,'getTotalVal("'+e.col.field+'")'),t=e.col.enableCellEdit?(t=(t=e.col.cellEditTemplate).replace(DISPLAY_CELL_TEMPLATE,o)).replace(EDITABLE_CELL_TEMPLATE,e.col.editableCellTemplate.replace(COL_FIELD,"row.entity."+e.col.field)):o,o=a(t)(e);e.enableCellSelection&&-1===o[0].className.indexOf("ngSelectionCell")&&(o[0].setAttribute("tabindex",0),o.addClass("ngCellElement")),r.append(o)},post:function(e,r){e.enableCellSelection&&e.domAccessProvider.selectionHandlers(e,r),e.$on("ngGridEventDigestCell",function(){o.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.317",
|
|
4
4
|
"description": "Reporting plugin for forms-angular",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"angular-messages":"^1.8.3",
|
|
37
37
|
"angular-mocks":"^1.8.3",
|
|
38
38
|
"angular-sanitize":"^1.8.3",
|
|
39
|
-
"forms-angular": "^0.12.0-beta.
|
|
39
|
+
"forms-angular": "^0.12.0-beta.317",
|
|
40
40
|
"grunt": "^1.6.1",
|
|
41
41
|
"grunt-autoprefixer": "^3.0.4",
|
|
42
42
|
"grunt-concurrent": "^3.0.0",
|
package/src/fng-reports.js
CHANGED
|
@@ -189,7 +189,7 @@ ${e.message}`);
|
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
var filter = angular.element(document.body).injector().get('$filter')(filterName.trim());
|
|
192
|
-
filters[col.field] = {filter: filter, filterParam: filterParam};
|
|
192
|
+
filters[col.displayName || col.field] = {filter: filter, filterParam: filterParam};
|
|
193
193
|
}
|
|
194
194
|
};
|
|
195
195
|
|
|
@@ -265,8 +265,12 @@ ${e.message}`);
|
|
|
265
265
|
function toTextValue(obj, conversionExpression) {
|
|
266
266
|
let retVal;
|
|
267
267
|
if (!(obj instanceof Date)) {
|
|
268
|
-
if (typeof obj === 'string'
|
|
269
|
-
|
|
268
|
+
if (typeof obj === 'string') {
|
|
269
|
+
if (obj.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3} \d{4}$/)) {
|
|
270
|
+
obj = new Date(obj.replace(' ', '+'));
|
|
271
|
+
} else if (obj.match(/^\d{13}$/)) {
|
|
272
|
+
obj = new Date(parseInt(obj, 10));
|
|
273
|
+
}
|
|
270
274
|
}
|
|
271
275
|
}
|
|
272
276
|
if (obj instanceof Date) {
|
|
@@ -397,7 +401,7 @@ ${e.message}`);
|
|
|
397
401
|
$scope.gridOptions.showColumnFooter = true;
|
|
398
402
|
colDef.aggregationType = uiGridConstants.aggregationTypes[colDef.aggregationTypeStr];
|
|
399
403
|
if (!colDef.aggregationType) {
|
|
400
|
-
colDef.aggregationType = function() {return eval(colDef.aggregationTypeStr)};
|
|
404
|
+
colDef.aggregationType = function() {return eval(colDef.aggregationTypeStr);};
|
|
401
405
|
}
|
|
402
406
|
colDef.aggregationHideLabel = colDef.aggregationTypeStr === 'sum';
|
|
403
407
|
colDef.footerCellFilter = colDef.cellFilter;
|
|
@@ -101,7 +101,7 @@ function ngGridCsvExportPlugin(opts) {
|
|
|
101
101
|
if (typeof col.doCSVExport === 'function') {
|
|
102
102
|
value = col.doCSVExport(value, row.entity, col);
|
|
103
103
|
}
|
|
104
|
-
csvData += '"' + csvStringify(value, filters[col.field]) + '",';
|
|
104
|
+
csvData += '"' + csvStringify(value, filters[col.displayName || col.field]) + '",';
|
|
105
105
|
}
|
|
106
106
|
});
|
|
107
107
|
csvData = swapLastCommaForNewline(csvData);
|
|
@@ -36,8 +36,7 @@ function ngGridPdfExportPlugin(options) {
|
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
self.createPDF = function () {
|
|
39
|
-
var
|
|
40
|
-
headerNames = [],
|
|
39
|
+
var headerInfo = [],
|
|
41
40
|
footers = [],
|
|
42
41
|
data = [],
|
|
43
42
|
filters = {},
|
|
@@ -50,13 +49,11 @@ function ngGridPdfExportPlugin(options) {
|
|
|
50
49
|
console.error(`Cannot export nested fields such as ${col.field}. Use $project to simplify.`);
|
|
51
50
|
} else {
|
|
52
51
|
if (!col.colDef || !col.colDef.cellTemplate) {
|
|
53
|
-
|
|
54
|
-
headerNames.push(col.field);
|
|
52
|
+
headerInfo.push({d: col.displayName, f: col.field});
|
|
55
53
|
} else {
|
|
56
54
|
const templateResp = self.scope.showsContent(col.colDef.cellTemplate, col.field);
|
|
57
55
|
if (templateResp === 'HTML') {
|
|
58
|
-
|
|
59
|
-
headerNames.push(col.field);
|
|
56
|
+
headerInfo.push({d: col.displayName, f: col.field});
|
|
60
57
|
transformers[col.field] = function (value) {
|
|
61
58
|
value = value.replace(/<p>/g, '\n\n');
|
|
62
59
|
value = value.replace(/<\/p>/g, '');
|
|
@@ -68,8 +65,7 @@ function ngGridPdfExportPlugin(options) {
|
|
|
68
65
|
return value;
|
|
69
66
|
};
|
|
70
67
|
} else if (templateResp) {
|
|
71
|
-
|
|
72
|
-
headerNames.push(col.field);
|
|
68
|
+
headerInfo.push({d: col.displayName, f: col.field});
|
|
73
69
|
}
|
|
74
70
|
}
|
|
75
71
|
}
|
|
@@ -83,13 +79,13 @@ function ngGridPdfExportPlugin(options) {
|
|
|
83
79
|
angular.forEach(self.scope.gridApi.core.getVisibleRows(), function (row) {
|
|
84
80
|
var output = [];
|
|
85
81
|
if (row.visible) {
|
|
86
|
-
|
|
87
|
-
var val = row.entity[h];
|
|
88
|
-
if (filters[h]) {
|
|
89
|
-
val = filters[h].filter(val, filters[h].filterParam);
|
|
82
|
+
headerInfo.forEach(function(h) {
|
|
83
|
+
var val = row.entity[h.f];
|
|
84
|
+
if (filters[h.d]) {
|
|
85
|
+
val = filters[h.d].filter(val, filters[h.d].filterParam);
|
|
90
86
|
}
|
|
91
|
-
if (transformers[h]) {
|
|
92
|
-
val = transformers[h](val);
|
|
87
|
+
if (transformers[h.f]) {
|
|
88
|
+
val = transformers[h.f](val);
|
|
93
89
|
}
|
|
94
90
|
if (typeof val === 'string') {
|
|
95
91
|
// chars > 255 cause BOM characters - see https://reallycare.freshdesk.com/a/tickets/2370
|
|
@@ -111,7 +107,7 @@ function ngGridPdfExportPlugin(options) {
|
|
|
111
107
|
// var doc = new jsPDF('landscape', 'mm', 'a4');
|
|
112
108
|
var doc = new jspdf.jsPDF('landscape', 'mm', 'a4');
|
|
113
109
|
doc.autoTable({
|
|
114
|
-
head: [
|
|
110
|
+
head: [headerInfo.map(h => h.d)],
|
|
115
111
|
body: data
|
|
116
112
|
});
|
|
117
113
|
|