fng-reports 0.12.0-beta.177 → 0.12.0-beta.178

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- /*! forms-angular 2022-02-22 */
1
+ /*! forms-angular 2022-04-02 */
2
2
  'use strict';
3
3
 
4
4
  formsAngular.controller('AnalysisCtrl', ['$rootScope', '$window', '$filter', '$scope', '$http', '$location', 'cssFrameworkService', 'routingService',
@@ -1,4 +1,4 @@
1
- /*! forms-angular 2022-02-22 */
1
+ /*! forms-angular 2022-04-02 */
2
2
 
3
3
  "use strict";formsAngular.controller("AnalysisCtrl",["$rootScope","$window","$filter","$scope","$http","$location","cssFrameworkService","routingService",function(e,r,l,a,c,s,n,t){var p=!0,o=new ngGridPdfExportPlugin({inhibitButton:!0}),i=new ngGridCsvExportPlugin({inhibitButton:!0});function u(r){try{return JSON.parse(r)}catch(e){throw new Error(`Invalid JSON ${r}
4
4
  ${e.message}`)}}if(angular.extend(a,t.parsePathFunc()(s.$$path)),a.reportSchema={columnDefs:[]},a.gridOptions={data:"report",columnDefs:a.reportSchema.columnDefs,showColumnMenu:!0,enableRowHeaderSelection:!1,enableFiltering:!1,showGridFooter:!1,reallyShowFooter:!1,showTotals:!0,enableColumnResizing:!0,footerRowHeight:65,multiSelect:!1,plugins:[o,i],onRegisterApi:function(r){a.gridApi=r,a.gridOptions.plugins.forEach(function(e){e.init(a,r.grid,null)}),r.selection.on.rowSelectionChanged(a,function(o){var e=a.reportSchema.drilldown;e&&(e=t.buildUrl(e.replace(/\|.+?\|/g,function(e){var r=e.slice(1,-1),t=/\((.+)\)/.exec(r);if(t){e=a.reportSchema.params[t[1]];return e?(a.param=a.record[t[1]],e.conversionExpression?a.$eval(e.conversionExpression):e.value):a.reportSchema.params[t[1]].value}return o.entity[r]})),window.location=e)})}},a.report=[],!a.reportSchemaName&&s.$$search.r)switch(s.$$search.r.slice(0,1)){case"[":a.reportSchema.pipeline=u(s.$$search.r);break;case"{":angular.extend(a.reportSchema,u(s.$$search.r));break;default:throw new Error("No report instructions specified")}function d(e){for(var r in a.paramSchema=[],a.record={},e){var t,o;e.hasOwnProperty(r)&&((t=e[r]).noInput||(o=a.paramSchema.push({name:r,id:"fp_"+r,label:t.label||l("titleCase")(r),type:t.type||"text",required:!0,add:t.add||void 0,size:t.size||("bs3"===n.frameWork?"large":"medium")}),"select"===t.type&&(a[r+"_Opts"]=t.enum,a.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])),a.record[r]=t.value)}a.$watch("record",function(e,r){r!==e&&(console.log("In the record watch ",JSON.stringify(e,null,2)),a.refreshQuery())},!0)}a.getTotalVal=function(r,e){var t="",o=_.find(a.reportSchema.columnDefs,function(e){return e.field===r});if(o)switch(o.totalsRow){case void 0:break;case"$SUM":for(var n=0,i=0;i<a.report.length;i++)n+=a.report[i][r];t=n,e&&(t=l(e)(t));break;default:t=o.totalsRow}return t},a.$on("exportToPDF",function(){o.createPDF()}),a.$on("exportToCSV",function(){i.createCSV()}),a.extractFilter=function(e,r){var t,o,n;e.cellFilter&&(-1===(o=e.cellFilter.indexOf(":"))?n=e.cellFilter:(n=e.cellFilter.slice(0,o).trim(),"'"!==(t=e.cellFilter.slice(o+1,999).trim())[0]&&'"'!==t[0]||(t=t.slice(1,-1))),n=angular.element(document.body).injector().get("$filter")(n.trim()),r[e.field]={filter:n,filterParam:t})};var f,m,h,g=document.querySelector("div.report-grow");g&&(h=g.offsetLeft,f=g.offsetTop+h,m=(m=document.querySelector("div.ui-grid-header"))?m.clientHeight:31,h=Math.floor((r.innerHeight-f-m-h)/30),angular.element(g).css("height",30*h+"px"));var S=e.navScope;S.items=[{fn:o.createPDF,text:"Save as PDF"},{fn:i.createCSV,text:"Export as CSV"}],S.contextMenu="Report",a.titleWithSubstitutions=a.reportSchema.title,a.inhibitRefresh||(a.refreshQuery=function(){function r(e){return e.replace(/\|.+?\|/g,function(e){e=e.slice(1,-1),e=/\((.+)\)/.exec(e);return e?a.reportSchema.params[e[1]].value:""})}var e="/api/report/"+a.modelName,t="?",o=!1,n=s.$$url.match(/\?.*/);if(a.reportSchemaName?e+="/"+a.reportSchemaName:n&&(p&&(a.paramSchema=JSON.parse(s.search().r).params,d(a.paramSchema)),e+=t+n[0].slice(1),t="&",o=!0),a.paramSchema){for(var i in a.record)if(a.record.hasOwnProperty(i)){var l=a.reportSchema.params[i];if(a.record[i]&&""!==a.record[i])a.param=a.record[i],l.conversionExpression&&(a.param=a.$eval(l.conversionExpression)),e+=t+i+"="+a.param,t="&";else if(l.required)return}}else!o&&n&&(e+=t+n[0].slice(1),t="&");return c.get(e).then(function(e){e=e.data;e.success?(a.report=e.report,a.reportSchema=e.schema,a.reportSchema.title=a.reportSchema.title||a.modelName,a.titleWithSubstitutions=r(a.reportSchema.title),a.gridOptions.enableFiltering=!!a.reportSchema.filter,S&&S.items&&(S.items.length=2,a.reportSchema.menu&&a.reportSchema.menu.forEach(function(e){S.items.push(JSON.parse(r(JSON.stringify(e))))})),p&&(p=!1,a.$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)))}),a.gridOptions.columnDefs=e}a.gridOptions.showTotals=r,a.gridOptions.reallyShowFooter=r,a.gridOptions.footerRowHeight=55+(r?10:0)},!0),!a.paramSchema&&e.schema.params&&d(e.schema.params))):(console.log(JSON.stringify(e)),a.reportSchema.title="Error - see console log")},function(e){console.log(JSON.stringify(e)),s.url("/404")})},a.refreshQuery()),a.showsContent=function(e){return/{{[\s]*COL_FIELD[\s]*}}/.test(e.replace(/(<([^>]+)>)/gi,""))},a.$on("$locationChangeStart",function(){delete S.contextMenu,delete S.items})}]);var COL_FIELD=/COL_FIELD/g;function ngGridCsvExportPlugin(e){var i=this;i.grid=null,i.scope=null,i.services=null,i.init=function(e,r,t){i.grid=r,i.scope=e,i.services=t},i.createCSV=function(){var e,r,t;e=i.scope.reportSchema.title+".csv",r="data:text/csv;charset=UTF-8,"+encodeURIComponent(i.prepareCSV()),(t=document.createElement("a")).download=e,t.href=r,r=new MouseEvent("click"),t.dispatchEvent(r)},i.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="",n={};return angular.forEach(i.grid.columns,function(e){i.scope.extractFilter(e,n),e.visible&&(!e.colDef.cellTemplate||i.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(i.scope.gridApi.core.getVisibleRows(),function(r){r.visible&&(angular.forEach(i.grid.columns,function(e){e.doCSVExport&&(o+='"'+t(r.entity[e.field],n[e.field])+'",')}),o=e(o))}),o}}function ngGridPdfExportPlugin(o){var l=this;l.grid=null,l.scope=null,l.services=null,l.options=o,l.init=function(e,r,t){l.grid=r,l.scope=e,l.services=t,o.inhibitButton||(t=r.$root.find(".ngFooterPanel"),null!=(r=r.$root.find(".ngFooterPanel .pdf-data-link-span"))&&r.remove(),t.append('<button class="pdf-data-link-span">PDF Export</button>'),t.on("click",function(){l.createPDF()}))},l.createPDF=function(){var t=[],n=[],o=[],e=[],i={};angular.forEach(l.grid.columns,function(e,r){!e.visible||e.colDef.cellTemplate&&!l.scope.showsContent(e.colDef.cellTemplate)||(t.push(e.displayName),n.push(e.field)),e.colDef.totalsRow&&(o[e.field]=l.grid.getTotalVal(e.field,e.filter).toString()),l.scope.extractFilter(e,i)}),angular.forEach(l.scope.gridApi.core.getVisibleRows(),function(t){var o=[];t.visible&&(n.forEach(function(e){var r=t.entity[e];"string"==typeof(r=i[e]?i[e].filter(r,i[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))});var r=new jspdf.jsPDF("landscape","mm","a4");r.autoTable({head:[t],body:e}),window.open(r.output("bloburl"))}}formsAngular.directive("ngTotalCell",["$compile","$domUtilityService",function(n,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,o=n(o)(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(){t.digest(e)})}}}}}]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fng-reports",
3
- "version": "0.12.0-beta.177",
3
+ "version": "0.12.0-beta.178",
4
4
  "description": "Reporting plugin for forms-angular",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,9 +21,9 @@
21
21
  "url": "https://github.com/forms-angular/fng-reports/issues"
22
22
  },
23
23
  "dependencies": {
24
- "angular-ui-grid": "4.11.0",
24
+ "angular-ui-grid": "4.11.1",
25
25
  "jquery": "^3.6.0",
26
- "jspdf": "2.4.0",
26
+ "jspdf": "2.5.1",
27
27
  "jspdf-autotable": "^3.5.23"
28
28
  },
29
29
  "devDependencies": {
@@ -32,25 +32,25 @@
32
32
  "angular-messages": "1.8.2",
33
33
  "angular-mocks": "1.8.2",
34
34
  "angular-sanitize": "1.8.2",
35
- "forms-angular": "0.12.0-beta.177",
35
+ "forms-angular": "0.12.0-beta.178",
36
36
  "grunt": "^1.4.1",
37
37
  "grunt-autoprefixer": "3.0.4",
38
38
  "grunt-concurrent": "3.0.0",
39
39
  "grunt-contrib-clean": "2.0.0",
40
40
  "grunt-contrib-concat": "2.0.0",
41
41
  "grunt-contrib-copy": "1.0.0",
42
- "grunt-contrib-jshint": "3.1.1",
43
- "grunt-contrib-uglify": "5.0.1",
42
+ "grunt-contrib-jshint": "3.2.0",
43
+ "grunt-contrib-uglify": "5.1.0",
44
44
  "grunt-contrib-watch": "^1.1.0",
45
45
  "grunt-karma": "4.0.2",
46
46
  "grunt-newer": "1.3.0",
47
47
  "grunt-ng-annotate": "4.0.0",
48
48
  "grunt-rev": "0.1.0",
49
49
  "grunt-usemin": "github:mchapman/grunt-usemin",
50
- "jasmine-core": "3.10.1",
51
- "karma": "^6.3.6",
52
- "karma-chrome-launcher": "3.1.0",
53
- "karma-jasmine": "4.0.1",
50
+ "jasmine-core": "4.0.1",
51
+ "karma": "^6.3.17",
52
+ "karma-chrome-launcher": "3.1.1",
53
+ "karma-jasmine": "4.0.2",
54
54
  "karma-junit-reporter": "2.0.1",
55
55
  "lodash": "^4.17.21",
56
56
  "matchdep": "2.0.0",