@ministryofjustice/hmpps-digital-prison-reporting-frontend 4.25.0 → 4.26.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/dpr/all.scss +17 -35
- package/dpr/components/_async/async-filters-form/style.scss +2 -2
- package/dpr/components/_async/request-details/style.scss +1 -1
- package/dpr/components/_charts/chart/Chart.js +1 -1
- package/dpr/components/_charts/chart/Chart.js.map +1 -1
- package/dpr/components/_charts/chart/ChartColours.js +1 -1
- package/dpr/components/_charts/chart/ChartColours.js.map +1 -1
- package/dpr/components/_charts/chart/ChartTimeseries.js +1 -1
- package/dpr/components/_charts/chart/ChartTimeseries.js.map +1 -1
- package/dpr/components/_charts/chart/bar/BarChart.js +1 -1
- package/dpr/components/_charts/chart/bar/BarChart.js.map +2 -2
- package/dpr/components/_charts/chart/bar/BarChart.ts +1 -1
- package/dpr/components/_charts/chart/bar-timeseries/BarTimeseriesChart.js +1 -1
- package/dpr/components/_charts/chart/bar-timeseries/BarTimeseriesChart.js.map +1 -1
- package/dpr/components/_charts/chart/buckets/Buckets.js +1 -1
- package/dpr/components/_charts/chart/buckets/Buckets.js.map +1 -1
- package/dpr/components/_charts/chart/doughnut/DoughnutChart.js +1 -1
- package/dpr/components/_charts/chart/doughnut/DoughnutChart.js.map +2 -2
- package/dpr/components/_charts/chart/doughnut/DoughnutChart.ts +1 -1
- package/dpr/components/_charts/chart/heatmap/HeatmapChart.js +1 -1
- package/dpr/components/_charts/chart/heatmap/HeatmapChart.js.map +3 -3
- package/dpr/components/_charts/chart/heatmap/HeatmapChart.ts +1 -1
- package/dpr/components/_charts/chart/line/LineChart.js +1 -1
- package/dpr/components/_charts/chart/line/LineChart.js.map +1 -1
- package/dpr/components/_charts/chart/line-timeseries/LineTimeseriesChart.js +1 -1
- package/dpr/components/_charts/chart/line-timeseries/LineTimeseriesChart.js.map +1 -1
- package/dpr/components/_charts/chart/styles.scss +6 -0
- package/dpr/components/_charts/chart/view.njk +2 -4
- package/dpr/components/_dashboards/scorecard/Scorecard.js +1 -1
- package/dpr/components/_dashboards/scorecard/Scorecard.js.map +2 -2
- package/dpr/components/_dashboards/scorecard/Scorecard.ts +0 -3
- package/dpr/components/_dashboards/scorecard-group/ScorecardGroup.js +1 -1
- package/dpr/components/_dashboards/scorecard-group/ScorecardGroup.js.map +3 -3
- package/dpr/components/_dashboards/scorecard-group/ScorecardGroup.ts +0 -3
- package/dpr/components/_filters/filters-interactive/style.scss +4 -3
- package/dpr/components/_filters/fitlers-save-defaults/styles.scss +0 -29
- package/dpr/components/_filters/fitlers-save-defaults/view.njk +2 -2
- package/dpr/components/_reports/report-heading/styles.scss +4 -0
- package/dpr/data/agentConfig.js +1 -1
- package/dpr/data/agentConfig.js.map +1 -1
- package/dpr/data/dashboardClient.js +1 -1
- package/dpr/data/dashboardClient.js.map +1 -1
- package/dpr/data/dprReportingClient.js +1 -1
- package/dpr/data/dprReportingClient.js.map +2 -2
- package/dpr/data/dprReportingClient.ts +1 -1
- package/dpr/data/missingReportClient.js +1 -1
- package/dpr/data/missingReportClient.js.map +1 -1
- package/dpr/data/productCollectionClient.js +1 -1
- package/dpr/data/productCollectionClient.js.map +1 -1
- package/dpr/data/reportDataStore.js +1 -1
- package/dpr/data/reportDataStore.js.map +1 -1
- package/dpr/data/reportingClient.js +1 -1
- package/dpr/data/reportingClient.js.map +1 -1
- package/dpr/data/restClient.js +1 -1
- package/dpr/data/restClient.js.map +1 -1
- package/dpr/routes/journeys/download-report/controller.js +1 -1
- package/dpr/routes/journeys/download-report/controller.js.map +1 -1
- package/dpr/routes/journeys/download-report/request-download/form/controller.js +1 -1
- package/dpr/routes/journeys/download-report/request-download/form/controller.js.map +1 -1
- package/dpr/routes/journeys/download-report/request-download/form/submitted/controller.js +1 -1
- package/dpr/routes/journeys/download-report/request-download/form/submitted/controller.js.map +1 -1
- package/dpr/routes/journeys/download-report/request-download/service.js +1 -1
- package/dpr/routes/journeys/download-report/request-download/service.js.map +1 -1
- package/dpr/routes/journeys/my-reports/bookmarks/controller.js +1 -1
- package/dpr/routes/journeys/my-reports/bookmarks/controller.js.map +1 -1
- package/dpr/routes/journeys/my-reports/bookmarks/list/controller.js +1 -1
- package/dpr/routes/journeys/my-reports/bookmarks/list/controller.js.map +1 -1
- package/dpr/routes/journeys/my-reports/bookmarks/service.js +4 -4
- package/dpr/routes/journeys/my-reports/bookmarks/service.js.map +2 -2
- package/dpr/routes/journeys/my-reports/recently-viewed/controller.js +1 -1
- package/dpr/routes/journeys/my-reports/recently-viewed/controller.js.map +1 -1
- package/dpr/routes/journeys/my-reports/recently-viewed/list/controller.js +1 -1
- package/dpr/routes/journeys/my-reports/recently-viewed/list/controller.js.map +1 -1
- package/dpr/routes/journeys/my-reports/requested-reports/controller.js +1 -1
- package/dpr/routes/journeys/my-reports/requested-reports/controller.js.map +1 -1
- package/dpr/routes/journeys/my-reports/requested-reports/list/controller.js +1 -1
- package/dpr/routes/journeys/my-reports/requested-reports/list/controller.js.map +1 -1
- package/dpr/routes/journeys/product-collection/selected/controller.js +1 -1
- package/dpr/routes/journeys/product-collection/selected/controller.js.map +1 -1
- package/dpr/routes/journeys/request-missing-report/form/controller.js +1 -1
- package/dpr/routes/journeys/request-missing-report/form/controller.js.map +1 -1
- package/dpr/routes/journeys/request-missing-report/submitted/controller.js +1 -1
- package/dpr/routes/journeys/request-missing-report/submitted/controller.js.map +1 -1
- package/dpr/routes/journeys/request-report/controller.js +1 -1
- package/dpr/routes/journeys/request-report/controller.js.map +1 -1
- package/dpr/routes/journeys/request-report/filters/controller.js +1 -1
- package/dpr/routes/journeys/request-report/filters/controller.js.map +1 -1
- package/dpr/routes/journeys/request-report/status/controller.js +1 -1
- package/dpr/routes/journeys/request-report/status/controller.js.map +1 -1
- package/dpr/routes/journeys/view-report/async/controller.js +1 -1
- package/dpr/routes/journeys/view-report/async/controller.js.map +1 -1
- package/dpr/routes/journeys/view-report/async/dashboard/controller.js +1 -1
- package/dpr/routes/journeys/view-report/async/dashboard/controller.js.map +1 -1
- package/dpr/routes/journeys/view-report/async/report/controller.js +1 -1
- package/dpr/routes/journeys/view-report/async/report/controller.js.map +1 -1
- package/dpr/routes/journeys/view-report/controller.js +1 -1
- package/dpr/routes/journeys/view-report/controller.js.map +1 -1
- package/dpr/routes/journeys/view-report/sync/dashboard/controller.js +1 -1
- package/dpr/routes/journeys/view-report/sync/dashboard/controller.js.map +1 -1
- package/dpr/routes/journeys/view-report/sync/load-report/controller.js +1 -1
- package/dpr/routes/journeys/view-report/sync/load-report/controller.js.map +1 -1
- package/dpr/routes/journeys/view-report/sync/report/controller.js +1 -1
- package/dpr/routes/journeys/view-report/sync/report/controller.js.map +1 -1
- package/dpr/services/defaultFilterValuesService.js +1 -1
- package/dpr/services/defaultFilterValuesService.js.map +1 -1
- package/dpr/services/featureFlagService.js +1 -1
- package/dpr/services/featureFlagService.js.map +1 -1
- package/dpr/services/missingReport/missingReportService.js +1 -1
- package/dpr/services/missingReport/missingReportService.js.map +1 -1
- package/dpr/services/productCollection/productCollectionService.js +1 -1
- package/dpr/services/productCollection/productCollectionService.js.map +1 -1
- package/dpr/services/productCollection/productCollectionStoreService.js +1 -1
- package/dpr/services/productCollection/productCollectionStoreService.js.map +1 -1
- package/dpr/services/reportStoreService.js +1 -1
- package/dpr/services/reportStoreService.js.map +1 -1
- package/dpr/types/DprUser.js +1 -1
- package/dpr/types/DprUser.js.map +1 -1
- package/dpr/types/ReportQuery.js +1 -1
- package/dpr/types/ReportQuery.js.map +1 -1
- package/dpr/types/express.d.js +1 -1
- package/dpr/types/express.d.js.map +4 -4
- package/dpr/types/express.d.ts +1 -1
- package/dpr/utils/CollatedSummaryBuilder/CollatedSummaryBuilder.js +1 -1
- package/dpr/utils/CollatedSummaryBuilder/CollatedSummaryBuilder.js.map +1 -1
- package/dpr/utils/DataTableBuilder/DataTableBuilder.js +1 -1
- package/dpr/utils/DataTableBuilder/DataTableBuilder.js.map +3 -3
- package/dpr/utils/DataTableBuilder/DataTableBuilder.test.ts +1 -0
- package/dpr/utils/DataTableBuilder/DataTableBuilder.ts +1 -1
- package/dpr/utils/DateMapper/DateMapper.js +1 -1
- package/dpr/utils/DateMapper/DateMapper.js.map +1 -1
- package/dpr/utils/ErrorHandler.js +1 -1
- package/dpr/utils/ErrorHandler.js.map +2 -2
- package/dpr/utils/ParentChildDataTableBuilder/ParentChildDataTableBuilder.js +1 -1
- package/dpr/utils/ParentChildDataTableBuilder/ParentChildDataTableBuilder.js.map +2 -2
- package/dpr/utils/SectionedDataTableBuilder/SectionedDataTableBuilder.js +1 -1
- package/dpr/utils/SectionedDataTableBuilder/SectionedDataTableBuilder.js.map +1 -1
- package/dpr/utils/SectionedFieldsTableBuilder/SectionedFieldsTableBuilder.js +1 -1
- package/dpr/utils/SectionedFieldsTableBuilder/SectionedFieldsTableBuilder.js.map +2 -2
- package/dpr/utils/SectionedFieldsTableBuilder/SectionedFieldsTableBuilder.ts +2 -2
- package/dpr/utils/SummaryDataTableBuilder/SummaryDataTableBuilder.js +1 -1
- package/dpr/utils/SummaryDataTableBuilder/SummaryDataTableBuilder.js.map +1 -1
- package/dpr/utils/UserStoreItemBuilder.js +1 -1
- package/dpr/utils/UserStoreItemBuilder.js.map +1 -1
- package/package.json +5 -4
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var g=Object.create;var m=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var w=(i,e)=>{for(var t in e)m(i,t,{get:e[t],enumerable:!0})},d=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of b(e))!C.call(i,a)&&a!==t&&m(i,a,{get:()=>e[a],enumerable:!(r=D(e,a))||r.enumerable});return i};var h=(i,e,t)=>(t=i!=null?g(S(i)):{},d(e||!i||!i.__esModule?m(t,"default",{value:i,enumerable:!0}):t,i)),v=i=>d(m({},"__esModule",{value:!0}),i);var K={};w(K,{DataTableBuilder:()=>u,default:()=>F});module.exports=v(K);var p=h(require("../urlHelper")),y=h(require("../DateMapper/DateMapper"));class u{
|
|
1
|
+
"use strict";var g=Object.create;var m=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var w=(i,e)=>{for(var t in e)m(i,t,{get:e[t],enumerable:!0})},d=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of b(e))!C.call(i,a)&&a!==t&&m(i,a,{get:()=>e[a],enumerable:!(r=D(e,a))||r.enumerable});return i};var h=(i,e,t)=>(t=i!=null?g(S(i)):{},d(e||!i||!i.__esModule?m(t,"default",{value:i,enumerable:!0}):t,i)),v=i=>d(m({},"__esModule",{value:!0}),i);var K={};w(K,{DataTableBuilder:()=>u,default:()=>F});module.exports=v(K);var p=h(require("../urlHelper")),y=h(require("../DateMapper/DateMapper"));class u{fields;sortData;columns=[];reportSummaries={};reportQuery=null;currentQueryParams=null;dateMapper=new y.default;constructor(e,t=!1){this.fields=e,this.sortData=t}mapDate(e){return e?this.dateMapper.toDateString(e,"local-datetime-short-year"):""}mapBoolean(e){return e?e.substring(0,1).toUpperCase()+e.substring(1).toLowerCase():""}mapRow(e,t="",r=[]){return this.fields.filter(a=>this.columns.includes(a.name)).map(a=>{const o=r.find(n=>n.name===a.name)??a;return this.mapCell(o,e,t)})}mapCell(e,t,r=""){const a=this.mapCellValue(e,t[e.name]);let s="string",o=r;e.wordWrap&&(o+=` data-table-cell-wrap-${e.wordWrap.toLowerCase()}`),e.header&&(o+=" govuk-table__header"),(e.type==="double"||e.type==="long")&&(s="numeric");const n=e.type==="HTML";return{fieldName:e.name,...n?{html:a}:{text:a},format:s,classes:o.trim()}}mapCellValue(e,t){if(e.calculated)return t;switch(e.type){case"boolean":return this.mapBoolean(t);case"date":case"time":return this.mapDate(t);default:return t||""}}mapHeader(e=!1,t=null){return this.fields.filter(r=>this.columns.includes(r.name)).map(r=>{if(this.reportQuery&&!e&&r.sortable){let a="none",s=(0,p.default)(this.currentQueryParams||{},{sortColumn:r.name,sortedAsc:"true"},this.fields);return r.name===this.reportQuery.sortColumn&&(a=this.reportQuery.sortedAsc?"ascending":"descending",this.reportQuery.sortedAsc&&(s=(0,p.default)(this.currentQueryParams||{},{sortColumn:r.name,sortedAsc:"false"},this.fields))),{html:`<a data-column="${r.name}" class="data-table-header-button data-table-header-button-sort-${a}" href="${s}">${r.display}</a>`,...t&&{classes:t}}}return{text:r.display,...t&&{classes:t}}})}mapData(e){const t=this.mapSummary("table-header"),r=this.mergeCells(e.map(s=>this.mapRow(s))),a=this.mapSummary("table-footer");return t.concat(r).concat(a)}mergeCells(e){const t=this.fields.filter(a=>a.mergeRows).map(a=>a.name);if(t.length===0)return e;const r={};return t.forEach(a=>{r[a]=e.reduce((s,o)=>{const n=this.getCellByFieldName(o,a);let l="";return n&&(l=n.text||n.html||""),{...s,[l]:(s[l]??0)+1}},{})}),e.map(a=>{let s=[...a];return t.forEach(o=>{const n=this.getCellByFieldName(a,o);let l,c;if(n&&r[o])switch(l=n.text||n.html||"",c=r[o][l],c){case-1:s=s.filter(f=>f.fieldName!==o);break;case 1:break;default:n.rowspan=c,r[o][l]=-1}}),s})}getCellByFieldName(e,t){return e.find(r=>r.fieldName===t)}mapSummary(e){return this.reportSummaries[e]?this.reportSummaries[e].flatMap(t=>t.data.map(r=>this.mapRow(r,`dpr-report-summary-cell dpr-report-summary-cell-${e}`,t.fields))):[]}sort(e){return this.appendSortKeyToData(e).sort(this.sortKeyComparison()).map(t=>({...t}))}sortKeyComparison(){return(e,t)=>{const r=e.sortKey,a=t.sortKey;return r===a?0:r<a?-1:1}}appendSortKeyToData(e,t=null){const r=t||this.fields;return e.map(a=>{const s=this.getSortKey(a,r);return{...a,sortKey:s}})}mapNamesToFields(e){return e.map(t=>this.fields.find(r=>r.name===t)).filter(t=>t!==void 0)}getSortKey(e,t){return t.map(r=>{const a=e[r.name];return a&&this.dateMapper.isDate(a)?this.dateMapper.toDateString(a,"iso"):this.mapCellValue(r,a)}).join("-").toLowerCase()}convertDataTableToHtml(e){const r=(e.head||[]).map(s=>`<th scope='col' class='govuk-table__header'>${s.html??s.text}</th>`),a=e.rows.map(s=>`<tr class='govuk-table__row'>${s.map(o=>`<td class='govuk-table__cell govuk-table__cell--${o.format} ${o.classes}'>${o.html??o.text}</td>`).join("")}</tr>`);return`<table class='govuk-table'><thead class='govuk-table__head'>${r.join("")}</thead><tbody class='govuk-table__body'>${a.join("")}</tbody></table>`}withHeaderOptions({reportQuery:e,columns:t,interactive:r}){return r&&e?this.withHeaderSortOptions(e):this.withNoHeaderOptions(t)}withHeaderSortOptions(e){return this.reportQuery=e,this.columns=e.columns,this.currentQueryParams=this.reportQuery.toRecordWithFilterPrefix(),this}withNoHeaderOptions(e){return this.columns=e,this}buildTable(e){const t=this.mapData(this.sortData?this.sort(e):e);return{head:this.mapHeader(),rows:t,rowCount:e.length,colCount:this.columns.length}}withSummaries(e){return this.reportSummaries=e,this}withSortedData(e=!0){return this.sortData=e,this}}var F=u;0&&(module.exports={DataTableBuilder});
|
|
2
2
|
//# sourceMappingURL=DataTableBuilder.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/dpr/utils/DataTableBuilder/DataTableBuilder.ts"],
|
|
4
|
-
"sourcesContent": ["import Dict = NodeJS.Dict\nimport ReportQuery from '../../types/ReportQuery'\nimport { Cell, CellFormat, DataTable, SortKey } from './types'\nimport createUrlForParameters from '../urlHelper'\nimport type { SummaryTemplate } from '../../types/Templates'\nimport { AsyncSummary } from '../../types/UserReports'\nimport DateMapper from '../DateMapper/DateMapper'\nimport { components } from '../../types/api'\n\nclass DataTableBuilder {\n protected fields: components['schemas']['FieldDefinition'][]\n\n private sortData: boolean\n\n protected columns: Array<string> = []\n\n protected reportSummaries: Dict<Array<AsyncSummary>> = {}\n\n // Sortable headers only\n private reportQuery: ReportQuery | null = null\n\n private currentQueryParams: NodeJS.Dict<string | Array<string>> | null = null\n\n private dateMapper = new DateMapper()\n\n constructor(fields: components['schemas']['FieldDefinition'][], sortData = false) {\n this.fields = fields\n this.sortData = sortData\n }\n\n private mapDate(isoDate?: string) {\n if (!isoDate) return ''\n\n return this.dateMapper.toDateString(isoDate, 'local-datetime-short-year')\n }\n\n private mapBoolean(value?: string) {\n if (!value) return ''\n return value.substring(0, 1).toUpperCase() + value.substring(1).toLowerCase()\n }\n\n protected mapRow(\n rowData: NodeJS.Dict<string>,\n extraClasses = '',\n overrideFields: components['schemas']['FieldDefinition'][] = [],\n ): Cell[] {\n return this.fields\n .filter((f) => this.columns.includes(f.name))\n .map((f) => {\n const overrideField = overrideFields.find((o) => o.name === f.name)\n const field = overrideField ?? f\n return this.mapCell(field, rowData, extraClasses)\n })\n }\n\n private mapCell(field: components['schemas']['FieldDefinition'], rowData: NodeJS.Dict<string>, extraClasses = '') {\n const textValue = this.mapCellValue(field, rowData[field.name])\n let fieldFormat: CellFormat = 'string'\n\n let classes = extraClasses\n\n if (field.wordWrap) {\n classes += ` data-table-cell-wrap-${field.wordWrap.toLowerCase()}`\n }\n\n if (field.header) {\n classes += ' govuk-table__header'\n }\n\n if (field.type === 'double' || field.type === 'long') {\n fieldFormat = 'numeric'\n }\n\n const isHtml = field.type === 'HTML'\n const cell: Cell = {\n fieldName: field.name,\n ...(isHtml ? { html: textValue } : { text: textValue }),\n format: fieldFormat,\n classes: classes.trim(),\n }\n\n return cell\n }\n\n protected mapCellValue(field: components['schemas']['FieldDefinition'], cellData?: string) {\n if (field.calculated) {\n return cellData\n }\n\n switch (field.type) {\n case 'boolean':\n return this.mapBoolean(cellData)\n\n case 'date':\n case 'time':\n return this.mapDate(cellData)\n\n default:\n return cellData\n }\n }\n\n protected mapHeader(disableSort = false, extraClasses: string | null = null): Cell[] {\n return this.fields\n .filter((field) => this.columns.includes(field.name))\n .map((f) => {\n if (this.reportQuery && !disableSort) {\n if (f.sortable) {\n let sortDirection = 'none'\n let url = createUrlForParameters(\n this.currentQueryParams || {},\n {\n sortColumn: f.name,\n sortedAsc: 'true',\n },\n this.fields,\n )\n\n if (f.name === this.reportQuery.sortColumn) {\n sortDirection = this.reportQuery.sortedAsc ? 'ascending' : 'descending'\n\n if (this.reportQuery.sortedAsc) {\n url = createUrlForParameters(\n this.currentQueryParams || {},\n {\n sortColumn: f.name,\n sortedAsc: 'false',\n },\n this.fields,\n )\n }\n }\n\n return {\n html:\n `<a ` +\n `data-column=\"${f.name}\" ` +\n `class=\"data-table-header-button data-table-header-button-sort-${sortDirection}\" ` +\n `href=\"${url}\"` +\n `>${f.display}</a>`,\n ...(extraClasses && { classes: extraClasses }),\n }\n }\n }\n return {\n text: f.display,\n ...(extraClasses && { classes: extraClasses }),\n }\n })\n }\n\n protected mapData(data: Array<Dict<string>>): Cell[][] {\n const mappedHeaderSummary = this.mapSummary('table-header')\n const mappedTableData = this.mergeCells(data.map((rowData) => this.mapRow(rowData)))\n const mappedFooterSummary = this.mapSummary('table-footer')\n\n return mappedHeaderSummary.concat(mappedTableData).concat(mappedFooterSummary)\n }\n\n private mergeCells(rows: Cell[][]): Cell[][] {\n const mergeFieldNames = this.fields\n .filter((f) => (<components['schemas']['SummaryField']>f).mergeRows)\n .map((f) => f.name)\n\n if (mergeFieldNames.length === 0) {\n return rows\n }\n\n const occurrences: Dict<Dict<number>> = {}\n mergeFieldNames.forEach((f) => {\n occurrences[f] = rows.reduce((accumulator: Dict<number>, currentRow) => {\n const currentCell = this.getCellByFieldName(currentRow, f)\n let cellValue = ''\n if (currentCell) {\n cellValue = currentCell.text || currentCell.html || ''\n }\n\n return {\n ...accumulator,\n [cellValue]: (accumulator[cellValue] ?? 0) + 1,\n }\n }, {})\n })\n\n return rows.map((row) => {\n let mergedRow = [...row]\n\n mergeFieldNames.forEach((mergeFieldName) => {\n const currentRowCell = this.getCellByFieldName(row, mergeFieldName)\n let cellValue\n let occurrencesOfValue\n if (currentRowCell && occurrences[mergeFieldName]) {\n cellValue = currentRowCell.text || currentRowCell.html || ''\n occurrencesOfValue = occurrences[mergeFieldName][cellValue]\n\n switch (occurrencesOfValue) {\n case -1:\n mergedRow = mergedRow.filter((c) => c.fieldName !== mergeFieldName)\n break\n\n case 1:\n break\n\n default:\n currentRowCell.rowspan = occurrencesOfValue\n occurrences[mergeFieldName][cellValue] = -1\n }\n }\n })\n\n return mergedRow\n })\n }\n\n private getCellByFieldName(row: Cell[], fieldName: string) {\n return row.find((c) => c.fieldName === fieldName)\n }\n\n private mapSummary(template: SummaryTemplate): Cell[][] {\n if (this.reportSummaries[template]) {\n return this.reportSummaries[template].flatMap((reportSummary) =>\n reportSummary.data.map((rowData) =>\n this.mapRow(\n rowData,\n `dpr-report-summary-cell dpr-report-summary-cell-${template}`,\n <components['schemas']['FieldDefinition'][]>reportSummary.fields,\n ),\n ),\n )\n }\n return []\n }\n\n protected sort(data: Dict<string>[]): Dict<string>[] {\n return this.appendSortKeyToData(data)\n .sort(this.sortKeyComparison())\n .map((d: SortKey) => ({\n ...d,\n }))\n }\n\n protected sortKeyComparison() {\n return (a: SortKey, b: SortKey) => {\n const aValue = a.sortKey\n const bValue = b.sortKey\n\n if (aValue === bValue) {\n return 0\n }\n\n if (aValue < bValue) {\n return -1\n }\n\n return 1\n }\n }\n\n private appendSortKeyToData(\n data: Dict<string>[],\n fields: components['schemas']['FieldDefinition'][] | null = null,\n ): SortKey[] {\n const sortFields = fields || this.fields\n\n return data.map((rowData) => {\n const sortKey = this.getSortKey(rowData, sortFields)\n\n return {\n ...rowData,\n sortKey,\n }\n })\n }\n\n protected mapNamesToFields(names: string[]): components['schemas']['FieldDefinition'][] {\n return names.map((s) => this.fields.find((f) => f.name === s)).filter((n) => n !== undefined)\n }\n\n protected getSortKey(rowData: NodeJS.Dict<string>, sortFields: components['schemas']['FieldDefinition'][]) {\n return sortFields\n .map((f) => {\n const value = rowData[f.name]\n if (value && this.dateMapper.isDate(value)) {\n return this.dateMapper.toDateString(value, 'iso')\n }\n\n return this.mapCellValue(f, value)\n })\n .join('-')\n .toLowerCase()\n }\n\n protected convertDataTableToHtml(dataTable: DataTable): string {\n const head = dataTable.head || []\n const headers = head.map((h) => `<th scope='col' class='govuk-table__header'>${h.html ?? h.text}</th>`)\n const rows = dataTable.rows.map(\n (r) =>\n `<tr class='govuk-table__row'>${r\n .map(\n (c) => `<td class='govuk-table__cell govuk-table__cell--${c.format} ${c.classes}'>${c.html ?? c.text}</td>`,\n )\n .join('')}</tr>`,\n )\n\n return (\n \"<table class='govuk-table'>\" +\n `<thead class='govuk-table__head'>${headers.join('')}</thead>` +\n `<tbody class='govuk-table__body'>${rows.join('')}</tbody>` +\n '</table>'\n )\n }\n\n withHeaderOptions({\n reportQuery,\n columns,\n interactive,\n }: {\n reportQuery?: ReportQuery\n columns: string[]\n interactive: boolean\n }) {\n if (interactive && reportQuery) {\n return this.withHeaderSortOptions(reportQuery)\n }\n return this.withNoHeaderOptions(columns)\n }\n\n withHeaderSortOptions(reportQuery: ReportQuery) {\n this.reportQuery = reportQuery\n this.columns = reportQuery.columns\n this.currentQueryParams = this.reportQuery.toRecordWithFilterPrefix()\n\n return this\n }\n\n withNoHeaderOptions(columns: string[]) {\n this.columns = columns\n return this\n }\n\n buildTable(data: Array<Dict<string>>): DataTable {\n const mappedData = this.mapData(this.sortData ? this.sort(data) : data)\n\n return {\n head: this.mapHeader(),\n rows: mappedData,\n rowCount: data.length,\n colCount: this.columns.length,\n }\n }\n\n withSummaries(reportSummaries: Dict<Array<AsyncSummary>>) {\n this.reportSummaries = reportSummaries\n return this\n }\n\n withSortedData(sortData = true) {\n this.sortData = sortData\n return this\n }\n}\n\nexport { DataTableBuilder }\nexport default DataTableBuilder\n"],
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAGA,IAAAK,EAAmC,2BAGnCC,EAAuB,uCAGvB,MAAMJ,CAAiB,
|
|
6
|
-
"names": ["DataTableBuilder_exports", "__export", "DataTableBuilder", "DataTableBuilder_default", "__toCommonJS", "import_urlHelper", "import_DateMapper", "
|
|
4
|
+
"sourcesContent": ["import Dict = NodeJS.Dict\nimport ReportQuery from '../../types/ReportQuery'\nimport { Cell, CellFormat, DataTable, SortKey } from './types'\nimport createUrlForParameters from '../urlHelper'\nimport type { SummaryTemplate } from '../../types/Templates'\nimport { AsyncSummary } from '../../types/UserReports'\nimport DateMapper from '../DateMapper/DateMapper'\nimport { components } from '../../types/api'\n\nclass DataTableBuilder {\n protected fields: components['schemas']['FieldDefinition'][]\n\n private sortData: boolean\n\n protected columns: Array<string> = []\n\n protected reportSummaries: Dict<Array<AsyncSummary>> = {}\n\n // Sortable headers only\n private reportQuery: ReportQuery | null = null\n\n private currentQueryParams: NodeJS.Dict<string | Array<string>> | null = null\n\n private dateMapper = new DateMapper()\n\n constructor(fields: components['schemas']['FieldDefinition'][], sortData = false) {\n this.fields = fields\n this.sortData = sortData\n }\n\n private mapDate(isoDate?: string) {\n if (!isoDate) return ''\n\n return this.dateMapper.toDateString(isoDate, 'local-datetime-short-year')\n }\n\n private mapBoolean(value?: string) {\n if (!value) return ''\n return value.substring(0, 1).toUpperCase() + value.substring(1).toLowerCase()\n }\n\n protected mapRow(\n rowData: NodeJS.Dict<string>,\n extraClasses = '',\n overrideFields: components['schemas']['FieldDefinition'][] = [],\n ): Cell[] {\n return this.fields\n .filter((f) => this.columns.includes(f.name))\n .map((f) => {\n const overrideField = overrideFields.find((o) => o.name === f.name)\n const field = overrideField ?? f\n return this.mapCell(field, rowData, extraClasses)\n })\n }\n\n private mapCell(field: components['schemas']['FieldDefinition'], rowData: NodeJS.Dict<string>, extraClasses = '') {\n const textValue = this.mapCellValue(field, rowData[field.name])\n let fieldFormat: CellFormat = 'string'\n\n let classes = extraClasses\n\n if (field.wordWrap) {\n classes += ` data-table-cell-wrap-${field.wordWrap.toLowerCase()}`\n }\n\n if (field.header) {\n classes += ' govuk-table__header'\n }\n\n if (field.type === 'double' || field.type === 'long') {\n fieldFormat = 'numeric'\n }\n\n const isHtml = field.type === 'HTML'\n const cell: Cell = {\n fieldName: field.name,\n ...(isHtml ? { html: textValue } : { text: textValue }),\n format: fieldFormat,\n classes: classes.trim(),\n }\n\n return cell\n }\n\n protected mapCellValue(field: components['schemas']['FieldDefinition'], cellData?: string) {\n if (field.calculated) {\n return cellData\n }\n\n switch (field.type) {\n case 'boolean':\n return this.mapBoolean(cellData)\n\n case 'date':\n case 'time':\n return this.mapDate(cellData)\n\n default:\n return cellData || ''\n }\n }\n\n protected mapHeader(disableSort = false, extraClasses: string | null = null): Cell[] {\n return this.fields\n .filter((field) => this.columns.includes(field.name))\n .map((f) => {\n if (this.reportQuery && !disableSort) {\n if (f.sortable) {\n let sortDirection = 'none'\n let url = createUrlForParameters(\n this.currentQueryParams || {},\n {\n sortColumn: f.name,\n sortedAsc: 'true',\n },\n this.fields,\n )\n\n if (f.name === this.reportQuery.sortColumn) {\n sortDirection = this.reportQuery.sortedAsc ? 'ascending' : 'descending'\n\n if (this.reportQuery.sortedAsc) {\n url = createUrlForParameters(\n this.currentQueryParams || {},\n {\n sortColumn: f.name,\n sortedAsc: 'false',\n },\n this.fields,\n )\n }\n }\n\n return {\n html:\n `<a ` +\n `data-column=\"${f.name}\" ` +\n `class=\"data-table-header-button data-table-header-button-sort-${sortDirection}\" ` +\n `href=\"${url}\"` +\n `>${f.display}</a>`,\n ...(extraClasses && { classes: extraClasses }),\n }\n }\n }\n return {\n text: f.display,\n ...(extraClasses && { classes: extraClasses }),\n }\n })\n }\n\n protected mapData(data: Array<Dict<string>>): Cell[][] {\n const mappedHeaderSummary = this.mapSummary('table-header')\n const mappedTableData = this.mergeCells(data.map((rowData) => this.mapRow(rowData)))\n const mappedFooterSummary = this.mapSummary('table-footer')\n\n return mappedHeaderSummary.concat(mappedTableData).concat(mappedFooterSummary)\n }\n\n private mergeCells(rows: Cell[][]): Cell[][] {\n const mergeFieldNames = this.fields\n .filter((f) => (<components['schemas']['SummaryField']>f).mergeRows)\n .map((f) => f.name)\n\n if (mergeFieldNames.length === 0) {\n return rows\n }\n\n const occurrences: Dict<Dict<number>> = {}\n mergeFieldNames.forEach((f) => {\n occurrences[f] = rows.reduce((accumulator: Dict<number>, currentRow) => {\n const currentCell = this.getCellByFieldName(currentRow, f)\n let cellValue = ''\n if (currentCell) {\n cellValue = currentCell.text || currentCell.html || ''\n }\n\n return {\n ...accumulator,\n [cellValue]: (accumulator[cellValue] ?? 0) + 1,\n }\n }, {})\n })\n\n return rows.map((row) => {\n let mergedRow = [...row]\n\n mergeFieldNames.forEach((mergeFieldName) => {\n const currentRowCell = this.getCellByFieldName(row, mergeFieldName)\n let cellValue\n let occurrencesOfValue\n if (currentRowCell && occurrences[mergeFieldName]) {\n cellValue = currentRowCell.text || currentRowCell.html || ''\n occurrencesOfValue = occurrences[mergeFieldName][cellValue]\n\n switch (occurrencesOfValue) {\n case -1:\n mergedRow = mergedRow.filter((c) => c.fieldName !== mergeFieldName)\n break\n\n case 1:\n break\n\n default:\n currentRowCell.rowspan = occurrencesOfValue\n occurrences[mergeFieldName][cellValue] = -1\n }\n }\n })\n\n return mergedRow\n })\n }\n\n private getCellByFieldName(row: Cell[], fieldName: string) {\n return row.find((c) => c.fieldName === fieldName)\n }\n\n private mapSummary(template: SummaryTemplate): Cell[][] {\n if (this.reportSummaries[template]) {\n return this.reportSummaries[template].flatMap((reportSummary) =>\n reportSummary.data.map((rowData) =>\n this.mapRow(\n rowData,\n `dpr-report-summary-cell dpr-report-summary-cell-${template}`,\n <components['schemas']['FieldDefinition'][]>reportSummary.fields,\n ),\n ),\n )\n }\n return []\n }\n\n protected sort(data: Dict<string>[]): Dict<string>[] {\n return this.appendSortKeyToData(data)\n .sort(this.sortKeyComparison())\n .map((d: SortKey) => ({\n ...d,\n }))\n }\n\n protected sortKeyComparison() {\n return (a: SortKey, b: SortKey) => {\n const aValue = a.sortKey\n const bValue = b.sortKey\n\n if (aValue === bValue) {\n return 0\n }\n\n if (aValue < bValue) {\n return -1\n }\n\n return 1\n }\n }\n\n private appendSortKeyToData(\n data: Dict<string>[],\n fields: components['schemas']['FieldDefinition'][] | null = null,\n ): SortKey[] {\n const sortFields = fields || this.fields\n\n return data.map((rowData) => {\n const sortKey = this.getSortKey(rowData, sortFields)\n\n return {\n ...rowData,\n sortKey,\n }\n })\n }\n\n protected mapNamesToFields(names: string[]): components['schemas']['FieldDefinition'][] {\n return names.map((s) => this.fields.find((f) => f.name === s)).filter((n) => n !== undefined)\n }\n\n protected getSortKey(rowData: NodeJS.Dict<string>, sortFields: components['schemas']['FieldDefinition'][]) {\n return sortFields\n .map((f) => {\n const value = rowData[f.name]\n if (value && this.dateMapper.isDate(value)) {\n return this.dateMapper.toDateString(value, 'iso')\n }\n\n return this.mapCellValue(f, value)\n })\n .join('-')\n .toLowerCase()\n }\n\n protected convertDataTableToHtml(dataTable: DataTable): string {\n const head = dataTable.head || []\n const headers = head.map((h) => `<th scope='col' class='govuk-table__header'>${h.html ?? h.text}</th>`)\n const rows = dataTable.rows.map(\n (r) =>\n `<tr class='govuk-table__row'>${r\n .map(\n (c) => `<td class='govuk-table__cell govuk-table__cell--${c.format} ${c.classes}'>${c.html ?? c.text}</td>`,\n )\n .join('')}</tr>`,\n )\n\n return (\n \"<table class='govuk-table'>\" +\n `<thead class='govuk-table__head'>${headers.join('')}</thead>` +\n `<tbody class='govuk-table__body'>${rows.join('')}</tbody>` +\n '</table>'\n )\n }\n\n withHeaderOptions({\n reportQuery,\n columns,\n interactive,\n }: {\n reportQuery?: ReportQuery\n columns: string[]\n interactive: boolean\n }) {\n if (interactive && reportQuery) {\n return this.withHeaderSortOptions(reportQuery)\n }\n return this.withNoHeaderOptions(columns)\n }\n\n withHeaderSortOptions(reportQuery: ReportQuery) {\n this.reportQuery = reportQuery\n this.columns = reportQuery.columns\n this.currentQueryParams = this.reportQuery.toRecordWithFilterPrefix()\n\n return this\n }\n\n withNoHeaderOptions(columns: string[]) {\n this.columns = columns\n return this\n }\n\n buildTable(data: Array<Dict<string>>): DataTable {\n const mappedData = this.mapData(this.sortData ? this.sort(data) : data)\n\n return {\n head: this.mapHeader(),\n rows: mappedData,\n rowCount: data.length,\n colCount: this.columns.length,\n }\n }\n\n withSummaries(reportSummaries: Dict<Array<AsyncSummary>>) {\n this.reportSummaries = reportSummaries\n return this\n }\n\n withSortedData(sortData = true) {\n this.sortData = sortData\n return this\n }\n}\n\nexport { DataTableBuilder }\nexport default DataTableBuilder\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAGA,IAAAK,EAAmC,2BAGnCC,EAAuB,uCAGvB,MAAMJ,CAAiB,CACX,OAEF,SAEE,QAAyB,CAAC,EAE1B,gBAA6C,CAAC,EAGhD,YAAkC,KAElC,mBAAiE,KAEjE,WAAa,IAAI,EAAAK,QAEzB,YAAYC,EAAoDC,EAAW,GAAO,CAChF,KAAK,OAASD,EACd,KAAK,SAAWC,CAClB,CAEQ,QAAQC,EAAkB,CAChC,OAAKA,EAEE,KAAK,WAAW,aAAaA,EAAS,2BAA2B,EAFnD,EAGvB,CAEQ,WAAWC,EAAgB,CACjC,OAAKA,EACEA,EAAM,UAAU,EAAG,CAAC,EAAE,YAAY,EAAIA,EAAM,UAAU,CAAC,EAAE,YAAY,EADzD,EAErB,CAEU,OACRC,EACAC,EAAe,GACfC,EAA6D,CAAC,EACtD,CACR,OAAO,KAAK,OACT,OAAQC,GAAM,KAAK,QAAQ,SAASA,EAAE,IAAI,CAAC,EAC3C,IAAKA,GAAM,CAEV,MAAMC,EADgBF,EAAe,KAAMG,GAAMA,EAAE,OAASF,EAAE,IAAI,GACnCA,EAC/B,OAAO,KAAK,QAAQC,EAAOJ,EAASC,CAAY,CAClD,CAAC,CACL,CAEQ,QAAQG,EAAiDJ,E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+
"names": ["DataTableBuilder_exports", "__export", "DataTableBuilder", "DataTableBuilder_default", "__toCommonJS", "import_urlHelper", "import_DateMapper", "DateMapper", "fields", "sortData", "isoDate", "value", "rowData", "extraClasses", "overrideFields", "f", "field", "o", "textValue", "fieldFormat", "classes", "isHtml", "cellData", "disableSort", "sortDirection", "url", "createUrlForParameters", "data", "mappedHeaderSummary", "mappedTableData", "mappedFooterSummary", "rows", "mergeFieldNames", "occurrences", "accumulator", "currentRow", "currentCell", "cellValue", "row", "mergedRow", "mergeFieldName", "currentRowCell", "occurrencesOfValue", "c", "fieldName", "template", "reportSummary", "d", "a", "b", "aValue", "bValue", "sortFields", "sortKey", "names", "s", "n", "dataTable", "headers", "h", "r", "reportQuery", "columns", "interactive", "mappedData", "reportSummaries"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var p=Object.create;var l=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var Y=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty;var f=(a,t)=>{for(var e in t)l(a,e,{get:t[e],enumerable:!0})},s=(a,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of h(t))!d.call(a,i)&&i!==e&&l(a,i,{get:()=>t[i],enumerable:!(r=u(t,i))||r.enumerable});return a};var m=(a,t,e)=>(e=a!=null?p(Y(a)):{},s(t||!a||!a.__esModule?l(e,"default",{value:a,enumerable:!0}):e,a)),g=a=>s(l({},"__esModule",{value:!0}),a);var T={};f(T,{DateMapper:()=>c,default:()=>F});module.exports=g(T);var o=m(require("dayjs")),D=m(require("dayjs/plugin/customParseFormat")),n=m(require("../logger"));class c{
|
|
1
|
+
"use strict";var p=Object.create;var l=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var Y=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty;var f=(a,t)=>{for(var e in t)l(a,e,{get:t[e],enumerable:!0})},s=(a,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of h(t))!d.call(a,i)&&i!==e&&l(a,i,{get:()=>t[i],enumerable:!(r=u(t,i))||r.enumerable});return a};var m=(a,t,e)=>(e=a!=null?p(Y(a)):{},s(t||!a||!a.__esModule?l(e,"default",{value:a,enumerable:!0}):e,a)),g=a=>s(l({},"__esModule",{value:!0}),a);var T={};f(T,{DateMapper:()=>c,default:()=>F});module.exports=g(T);var o=m(require("dayjs")),D=m(require("dayjs/plugin/customParseFormat")),n=m(require("../logger"));class c{isoDateRegEx=/^(\d{4}[/-](0?[1-9]|1[012])[/-](0?[1-9]|[12][0-9]|3[01]))/;localDateRegEx=/^(0?[1-9]|[12][0-9]|3[01])[/-](0?[1-9]|1[012])[/-]\d{4}$/;localDateShortYearRegEx=/^(0?[1-9]|[12][0-9]|3[01])[/-](0?[1-9]|1[012])[/-]\d{2}$/;localDateTimeRegEx=/^(0?[1-9]|[12][0-9]|3[01])[/-](0?[1-9]|1[012])[/-]\d{4} [0-2]\d:[0-5]\d$/;localDateTimeShortYearRegEx=/^(0?[1-9]|[12][0-9]|3[01])[/-](0?[1-9]|1[012])[/-]\d{2} [0-2]\d:[0-5]\d$/;isoFormat="YYYY-MM-DD";localDateFormatInput="D/M/YYYY";localDateFormatOutput="DD/MM/YYYY";localDateShortYearFormatInput="D/M/YY";localDateShortYearFormatOutput="DD/MM/YY";localDateTimeFormatInput="D/M/YYYY HH:mm";localDateTimeFormatOutput="DD/MM/YYYY HH:mm";localDateTimeShortYearFormatInput="D/M/YY HH:mm";localDateTimeShortYearFormatOutput="DD/MM/YY HH:mm";getDateType(t){if(t&&t.match){if(t.match(this.isoDateRegEx))return"iso";if(t.match(this.localDateRegEx))return"local-date";if(t.match(this.localDateShortYearRegEx))return"local-date-short-year";if(t.match(this.localDateTimeRegEx))return"local-datetime";if(t.match(this.localDateTimeShortYearRegEx))return"local-datetime-short-year"}return"none"}getDateWrapper(t){if(o.default.extend(D.default),!t)return null;switch(this.getDateType(t)){case"iso":return(0,o.default)(t);case"local-date":return(0,o.default)(t,this.localDateFormatInput);case"local-date-short-year":return(0,o.default)(t,this.localDateShortYearFormatInput);case"local-datetime":return(0,o.default)(t,this.localDateTimeFormatInput);case"local-datetime-short-year":return(0,o.default)(t,this.localDateTimeShortYearFormatInput);default:return null}}isDate(t){return this.getDateType(t)!=="none"}toDateString(t,e){const r=this.getDateWrapper(t);if(r)switch(e){case"iso":return r.format(this.isoFormat);case"local-date":return r.format(this.localDateFormatOutput);case"local-date-short-year":return r.format(this.localDateShortYearFormatOutput);case"local-datetime":return r.format(this.localDateTimeFormatOutput);case"local-datetime-short-year":return r.format(this.localDateTimeShortYearFormatOutput);default:n.default.warn(`Invalid date type: ${e}`);return}t&&n.default.warn(`Could not map non-date value : ${t}`)}}var F=c;0&&(module.exports={DateMapper});
|
|
2
2
|
//# sourceMappingURL=DateMapper.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/dpr/utils/DateMapper/DateMapper.ts"],
|
|
4
4
|
"sourcesContent": ["import dayjs, { Dayjs } from 'dayjs'\nimport customParseFormat from 'dayjs/plugin/customParseFormat'\nimport { DateType } from './types'\nimport logger from '../logger'\n\nclass DateMapper {\n private isoDateRegEx = /^(\\d{4}[/-](0?[1-9]|1[012])[/-](0?[1-9]|[12][0-9]|3[01]))/\n\n private localDateRegEx = /^(0?[1-9]|[12][0-9]|3[01])[/-](0?[1-9]|1[012])[/-]\\d{4}$/\n\n private localDateShortYearRegEx = /^(0?[1-9]|[12][0-9]|3[01])[/-](0?[1-9]|1[012])[/-]\\d{2}$/\n\n private localDateTimeRegEx = /^(0?[1-9]|[12][0-9]|3[01])[/-](0?[1-9]|1[012])[/-]\\d{4} [0-2]\\d:[0-5]\\d$/\n\n private localDateTimeShortYearRegEx = /^(0?[1-9]|[12][0-9]|3[01])[/-](0?[1-9]|1[012])[/-]\\d{2} [0-2]\\d:[0-5]\\d$/\n\n private isoFormat = 'YYYY-MM-DD'\n\n private localDateFormatInput = 'D/M/YYYY'\n\n private localDateFormatOutput = 'DD/MM/YYYY'\n\n private localDateShortYearFormatInput = 'D/M/YY'\n\n private localDateShortYearFormatOutput = 'DD/MM/YY'\n\n private localDateTimeFormatInput = 'D/M/YYYY HH:mm'\n\n private localDateTimeFormatOutput = 'DD/MM/YYYY HH:mm'\n\n private localDateTimeShortYearFormatInput = 'D/M/YY HH:mm'\n\n private localDateTimeShortYearFormatOutput = 'DD/MM/YY HH:mm'\n\n getDateType(value: string | null): DateType {\n if (value && value.match) {\n if (value.match(this.isoDateRegEx)) {\n return 'iso'\n }\n\n if (value.match(this.localDateRegEx)) {\n return 'local-date'\n }\n\n if (value.match(this.localDateShortYearRegEx)) {\n return 'local-date-short-year'\n }\n\n if (value.match(this.localDateTimeRegEx)) {\n return 'local-datetime'\n }\n\n if (value.match(this.localDateTimeShortYearRegEx)) {\n return 'local-datetime-short-year'\n }\n }\n\n return 'none'\n }\n\n getDateWrapper(value: string | null): Dayjs | null {\n dayjs.extend(customParseFormat)\n if (!value) {\n return null\n }\n switch (this.getDateType(value)) {\n case 'iso':\n return dayjs(value)\n case 'local-date':\n return dayjs(value, this.localDateFormatInput)\n case 'local-date-short-year':\n return dayjs(value, this.localDateShortYearFormatInput)\n case 'local-datetime':\n return dayjs(value, this.localDateTimeFormatInput)\n case 'local-datetime-short-year':\n return dayjs(value, this.localDateTimeShortYearFormatInput)\n default:\n return null\n }\n }\n\n isDate(value: string | null): boolean {\n return this.getDateType(value) !== 'none'\n }\n\n toDateString(value: string | null, type: DateType): string | undefined {\n const dateWrapper = this.getDateWrapper(value)\n\n if (dateWrapper) {\n switch (type) {\n case 'iso':\n return dateWrapper.format(this.isoFormat)\n case 'local-date':\n return dateWrapper.format(this.localDateFormatOutput)\n case 'local-date-short-year':\n return dateWrapper.format(this.localDateShortYearFormatOutput)\n case 'local-datetime':\n return dateWrapper.format(this.localDateTimeFormatOutput)\n case 'local-datetime-short-year':\n return dateWrapper.format(this.localDateTimeShortYearFormatOutput)\n default:\n logger.warn(`Invalid date type: ${type}`)\n return undefined\n }\n }\n\n if (value) {\n logger.warn(`Could not map non-date value : ${value}`)\n }\n return undefined\n }\n}\n\nexport { DateMapper }\nexport default DateMapper\n"],
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAA6B,oBAC7BC,EAA8B,6CAE9BC,EAAmB,wBAEnB,MAAML,CAAW,
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAA6B,oBAC7BC,EAA8B,6CAE9BC,EAAmB,wBAEnB,MAAML,CAAW,CACP,aAAe,4DAEf,eAAiB,2DAEjB,wBAA0B,2DAE1B,mBAAqB,2EAErB,4BAA8B,2EAE9B,UAAY,aAEZ,qBAAuB,WAEvB,sBAAwB,aAExB,8BAAgC,SAEhC,+BAAiC,WAEjC,yBAA2B,iBAE3B,0BAA4B,mBAE5B,kCAAoC,eAEpC,mCAAqC,iBAE7C,YAAYM,EAAgC,CAC1C,GAAIA,GAASA,EAAM,MAAO,CACxB,GAAIA,EAAM,MAAM,KAAK,YAAY,EAC/B,MAAO,MAGT,GAAIA,EAAM,MAAM,KAAK,cAAc,EACjC,MAAO,aAGT,GAAIA,EAAM,MAAM,KAAK,uBAAuB,EAC1C,MAAO,wBAGT,GAAIA,EAAM,MAAM,KAAK,kBAAkB,EACrC,MAAO,iBAGT,GAAIA,EAAM,MAAM,KAAK,2BAA2B,EAC9C,MAAO,2BAEX,CAEA,MAAO,MACT,CAEA,eAAeA,EAAoC,CAEjD,GADA,EAAAC,QAAM,OAAO,EAAAC,OAAiB,EAC1B,CAACF,EACH,OAAO,KAET,OAAQ,KAAK,YAAYA,CAAK,EAAG,CAC/B,IAAK,MACH,SAAO,EAAAC,SAAMD,CAAK,EACpB,IAAK,aACH,SAAO,EAAAC,SAAMD,EAAO,KAAK,oBAAoB,EAC/C,IAAK,wBACH,SAAO,EAAAC,SAAMD,EAAO,KAAK,6BAA6B,EACxD,IAAK,iBACH,SAAO,EAAAC,SAAMD,EAAO,KAAK,wBAAwB,EACnD,IAAK,4BACH,SAAO,EAAAC,SAAMD,EAAO,KAAK,iCAAiC,EAC5D,QACE,OAAO,IACX,CACF,CAEA,OAAOA,EAA+B,CACpC,OAAO,KAAK,YAAYA,CAAK,IAAM,MACrC,CAEA,aAAaA,EAAsBG,EAAoC,CACrE,MAAMC,EAAc,KAAK,eAAeJ,CAAK,EAE7C,GAAII,EACF,OAAQD,EAAM,CACZ,IAAK,MACH,OAAOC,EAAY,OAAO,KAAK,SAAS,EAC1C,IAAK,aACH,OAAOA,EAAY,OAAO,KAAK,qBAAqB,EACtD,IAAK,wBACH,OAAOA,EAAY,OAAO,KAAK,8BAA8B,EAC/D,IAAK,iBACH,OAAOA,EAAY,OAAO,KAAK,yBAAyB,EAC1D,IAAK,4BACH,OAAOA,EAAY,OAAO,KAAK,kCAAkC,EACnE,QACE,EAAAC,QAAO,KAAK,sBAAsBF,CAAI,EAAE,EACxC,MACJ,CAGEH,GACF,EAAAK,QAAO,KAAK,kCAAkCL,CAAK,EAAE,CAGzD,CACF,CAGA,IAAOL,EAAQD",
|
|
6
6
|
"names": ["DateMapper_exports", "__export", "DateMapper", "DateMapper_default", "__toCommonJS", "import_dayjs", "import_customParseFormat", "import_logger", "value", "dayjs", "customParseFormat", "type", "dateWrapper", "logger"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var h=Object.create;var a=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var c=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty;var f=(s,e)=>{for(var r in e)a(s,r,{get:e[r],enumerable:!0})},g=(s,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of u(e))!d.call(s,t)&&t!==r&&a(s,t,{get:()=>e[t],enumerable:!(o=p(e,t))||o.enumerable});return s};var l=(s,e,r)=>(r=s!=null?h(c(s)):{},g(e||!s||!s.__esModule?a(r,"default",{value:s,enumerable:!0}):r,s)),m=s=>g(a({},"__esModule",{value:!0}),s);var E={};f(E,{ErrorHandler:()=>i,default:()=>M});module.exports=m(E);var n=l(require("./logger"));class i{constructor(e){this.formatError=()=>this.handleError();
|
|
1
|
+
"use strict";var h=Object.create;var a=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var c=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty;var f=(s,e)=>{for(var r in e)a(s,r,{get:e[r],enumerable:!0})},g=(s,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of u(e))!d.call(s,t)&&t!==r&&a(s,t,{get:()=>e[t],enumerable:!(o=p(e,t))||o.enumerable});return s};var l=(s,e,r)=>(r=s!=null?h(c(s)):{},g(e||!s||!s.__esModule?a(r,"default",{value:s,enumerable:!0}):r,s)),m=s=>g(a({},"__esModule",{value:!0}),s);var E={};f(E,{ErrorHandler:()=>i,default:()=>M});module.exports=m(E);var n=l(require("./logger"));class i{error;developerMessage;userMessage;moreInfo;stack;status;constructor(e){this.error=e,n.default.error(`Error: ${JSON.stringify(e)}`)}formatError=()=>this.handleError();handleError=()=>{if(typeof this.error=="string")this.developerMessage=this.error;else if(this.error.data){const r=this.error.data;this.developerMessage=r.developerMessage,this.userMessage=r.userMessage,this.moreInfo=r.moreInfo,this.status=r.status}else if(Object.prototype.hasOwnProperty.call(this.error,"message")){const r=this.error;this.userMessage=r.message,this.stack=r.stack,this.status=500}else if(Object.prototype.hasOwnProperty.call(this.error,"developerMessage")){const r=this.error;this.developerMessage=r.developerMessage,this.userMessage=r.userMessage,this.moreInfo=r.moreInfo,this.status=r.status}else if(Object.prototype.hasOwnProperty.call(this.error,"userMessage")){const r=this.error;if(r.stack&&r.stack.includes("ZodError")){const o=JSON.parse(r.userMessage);this.userMessage=o.map(t=>t.message).join(", "),this.status=500,this.stack=r.stack}}const e={...this.developerMessage&&{developerMessage:this.developerMessage},...this.userMessage&&{userMessage:this.userMessage},...this.moreInfo&&{moreInfo:this.moreInfo},...this.stack&&{stack:this.stack},...this.status&&{status:this.status}};return n.default.error(JSON.stringify(e,null,2)),e}}var M=i;0&&(module.exports={ErrorHandler});
|
|
2
2
|
//# sourceMappingURL=ErrorHandler.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/dpr/utils/ErrorHandler.ts"],
|
|
4
4
|
"sourcesContent": ["import { components } from '../types/api'\nimport logger from './logger'\n\ninterface DprErrorMessage {\n userMessage?: string\n developerMessage?: string\n stack?: string\n moreInfo?: string\n status?: string | number\n}\n\ninterface DprErrorData {\n data: components['schemas']['ErrorResponse']\n}\n\ninterface ZodValidationError {\n userMessage: string\n stack: string\n}\n\nclass ErrorHandler {\n error: Error | components['schemas']['ErrorResponse'] | string | undefined | unknown | DprErrorData\n\n developerMessage?: string | undefined\n\n userMessage?: string | undefined\n\n moreInfo?: string | undefined\n\n stack?: string | undefined\n\n status?: number | string | undefined\n\n constructor(error: Error | components['schemas']['ErrorResponse'] | string | undefined | unknown) {\n this.error = error\n logger.error(`Error: ${JSON.stringify(error)}`)\n }\n\n formatError = (): DprErrorMessage => {\n return this.handleError()\n }\n\n private handleError = (): DprErrorMessage => {\n // status: FAILED\n if (typeof this.error === 'string') {\n this.developerMessage = this.error\n }\n\n // Error response\n else if ((<DprErrorData>this.error).data) {\n const error = (<DprErrorData>this.error).data\n this.developerMessage = error.developerMessage\n this.userMessage = error.userMessage\n this.moreInfo = error.moreInfo\n this.status = error.status\n }\n\n // client side error\n else if (Object.prototype.hasOwnProperty.call(this.error, 'message')) {\n const error = <Error>this.error\n this.userMessage = error.message\n this.stack = error.stack\n this.status = 500\n }\n\n // Server response error\n else if (Object.prototype.hasOwnProperty.call(this.error, 'developerMessage')) {\n const error = <components['schemas']['ErrorResponse']>this.error\n this.developerMessage = error.developerMessage\n this.userMessage = error.userMessage\n this.moreInfo = error.moreInfo\n this.status = error.status\n }\n\n // Zod error\n else if (Object.prototype.hasOwnProperty.call(this.error, 'userMessage')) {\n const error = <ZodValidationError>this.error\n if (error.stack && error.stack.includes('ZodError')) {\n const errorArr: { message: string }[] = JSON.parse(error.userMessage)\n this.userMessage = errorArr.map((m) => m.message).join(', ')\n this.status = 500\n this.stack = error.stack\n }\n }\n\n const formattedError = {\n ...(this.developerMessage && { developerMessage: this.developerMessage }),\n ...(this.userMessage && { userMessage: this.userMessage }),\n ...(this.moreInfo && { moreInfo: this.moreInfo }),\n ...(this.stack && { stack: this.stack }),\n ...(this.status && { status: this.status }),\n }\n\n logger.error(JSON.stringify(formattedError, null, 2))\n\n return formattedError\n }\n}\n\nexport { ErrorHandler }\nexport default ErrorHandler\n"],
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GACA,IAAAK,EAAmB,uBAmBnB,MAAMH,CAAa,
|
|
6
|
-
"names": ["ErrorHandler_exports", "__export", "ErrorHandler", "ErrorHandler_default", "__toCommonJS", "import_logger", "error", "
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GACA,IAAAK,EAAmB,uBAmBnB,MAAMH,CAAa,CACjB,MAEA,iBAEA,YAEA,SAEA,MAEA,OAEA,YAAYI,EAAsF,CAChG,KAAK,MAAQA,EACb,EAAAC,QAAO,MAAM,UAAU,KAAK,UAAUD,CAAK,CAAC,EAAE,CAChD,CAEA,YAAc,IACL,KAAK,YAAY,EAGlB,YAAc,IAAuB,CAE3C,GAAI,OAAO,KAAK,OAAU,SACxB,KAAK,iB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["ErrorHandler_exports", "__export", "ErrorHandler", "ErrorHandler_default", "__toCommonJS", "import_logger", "error", "logger", "errorArr", "m", "formattedError"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var K=Object.create;var m=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var A=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var N=(n,t)=>{for(var a in t)m(n,a,{get:t[a],enumerable:!0})},y=(n,t,a,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of v(t))!w.call(n,e)&&e!==a&&m(n,e,{get:()=>t[e],enumerable:!(i=P(t,e))||i.enumerable});return n};var f=(n,t,a)=>(a=n!=null?K(A(n)):{},y(t||!n||!n.__esModule?m(a,"default",{value:n,enumerable:!0}):a,n)),F=n=>y(m({},"__esModule",{value:!0}),n);var H={};N(H,{ParentChildDataTableBuilder:()=>u,default:()=>B});module.exports=F(H);var S=f(require("../DataTableBuilder/DataTableBuilder")),g=require("../arrayUtils"),b=f(require("../SectionedDataTableBuilder/SectionedDataTableBuilder"));class u extends b.default{variant;childVariants;childData=[];constructor(t){const{specification:a}=t,{sections:i,template:e}=a;super(a),this.sections=i,this.template=e,this.variant=t,this.childVariants=this.variant.childVariants||[]}createParentChildTable(t,a){let i={};const e=this.mapNamesToFields(this.childVariants.flatMap(r=>r.joinFields).reduce(g.distinct,[])),s=this.calculateParentChildKeys(t,e);s.forEach(r=>{i[r.sortKey]={parent:[]}}),i=this.splitParentDataIntoSections(i,t,e),i=this.splitChildDataIntoSections(s,i);const c=this.createChildDataTableBuilders();return s.flatMap(r=>{const l=i[r.sortKey]||{};let h=[];return l&&(h=l.parent?l.parent:[]),[a].concat(h.map(d=>this.mapRow(d,"dpr-parent-cell"))).concat(this.childVariants.filter(d=>l&&l[d.id]).map(d=>{const p=c[d.id],D=l[d.id],C=p&&D?p.buildTable(D):void 0,T=C?this.convertDataTableToHtml(C):"";return[{classes:"dpr-child-report-cell",format:"string",html:`<div class='dpr-child-report'><h2 class="govuk-heading-s">${d.name}</h2><div class="dpr-child-report_table">${T}</div></div>`,colspan:this.columns.length}]}))})}createParentChildSectionRows(t,a){const e=this.mapSections(t).sectionedData,s=[];return Object.keys(e).forEach(o=>{const r=e[o];s.push({sectionDescription:o,...this.getSectionCount(e,o),rows:this.createParentChildTable(r,a)})}),s.flatMap((o,r)=>[...this.createSectionHeader(o.sectionDescription,r,o.count,o.countDescription),...o.rows])}mapParentChildData(t,a){return this.sections?.length?this.createParentChildSectionRows(t,a):this.createParentChildTable(t,a)}createChildDataTableBuilders(){return this.childVariants.reduce((a,i)=>{const{specification:e}=i,s=e?e.fields:[],c=s.filter(r=>r.visible||r.mandatory).map(r=>r.name),o=new S.default(s).withNoHeaderOptions(c).withSortedData();return{...a,[i.id]:o}},{})}calculateParentChildKeys(t,a){return t.map(i=>({sortKey:this.getSortKey(i,a),childSortKeys:this.childVariants.reduce((e,s)=>({...e,[s.id]:this.getSortKey(i,this.mapNamesToFields(s.joinFields))}),{})})).reduce((i,e)=>i.find(s=>s.sortKey===e.sortKey)?i:i.concat(e),[])}splitParentDataIntoSections(t,a,i){return a.reduce((e,s)=>{const c=this.getSortKey(s,i),o=e[c]?e[c].parent:[];return{...e,...o&&{[c]:{parent:o.concat(s)}}}},t)}splitChildDataIntoSections(t,a){const i={...a};return this.childVariants.forEach(e=>{const s=this.mapNamesToFields(e.joinFields),c=this.childData.find(r=>r.id===e.id);(c?c.data:[]).filter(r=>{const l=this.getSortKey(r,s);return t.find(h=>h.childSortKeys[e.id]===l)}).forEach(r=>{const l=this.getSortKey(r,s),h=t.find(D=>D.childSortKeys[e.id]===l),d=h?h.sortKey:"",p=i[d];if(p){const D=p[e.id]||[];p[e.id]=D.concat(r)}})}),i}withChildData(t){return this.childData=t,this}buildTable(t){return{head:null,rows:this.mapParentChildData(t,this.mapHeader(!0,"govuk-table__header")),rowCount:t.length,colCount:this.columns.length}}}var B=u;0&&(module.exports={ParentChildDataTableBuilder});
|
|
2
2
|
//# sourceMappingURL=ParentChildDataTableBuilder.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/dpr/utils/ParentChildDataTableBuilder/ParentChildDataTableBuilder.ts"],
|
|
4
4
|
"sourcesContent": ["import Dict = NodeJS.Dict\nimport { components } from '../../types/api'\nimport { Cell, DataTable } from '../DataTableBuilder/types'\nimport DataTableBuilder from '../DataTableBuilder/DataTableBuilder'\nimport { distinct } from '../arrayUtils'\nimport { ChildData, ParentChildSortKey } from './types'\nimport SectionedDataTableBuilder from '../SectionedDataTableBuilder/SectionedDataTableBuilder'\n\nclass ParentChildDataTableBuilder extends SectionedDataTableBuilder {\n variant: components['schemas']['VariantDefinition']\n\n childVariants: components['schemas']['ChildVariantDefinition'][]\n\n childData: Array<ChildData> = []\n\n constructor(variant: components['schemas']['VariantDefinition']) {\n const { specification } = variant\n const { sections, template } = <components['schemas']['Specification']>specification\n super(<components['schemas']['Specification']>specification)\n\n this.sections = sections\n this.template = template\n this.variant = variant\n this.childVariants = this.variant.childVariants || []\n }\n\n private createParentChildTable(parentData: Array<Dict<string>>, header: Cell[]) {\n let sectionedParentChildData: Dict<Dict<Array<Dict<string>>>> = {}\n const joinFields = this.mapNamesToFields(this.childVariants.flatMap((c) => c.joinFields).reduce(distinct, []))\n // Get the parent-child joins definition data\n\n // Create the section keys and\n const parentChildKeys = this.calculateParentChildKeys(parentData, joinFields)\n parentChildKeys.forEach((parentKey) => {\n sectionedParentChildData[parentKey.sortKey] = {\n parent: [],\n }\n })\n\n sectionedParentChildData = this.splitParentDataIntoSections(sectionedParentChildData, parentData, joinFields)\n sectionedParentChildData = this.splitChildDataIntoSections(parentChildKeys, sectionedParentChildData)\n\n const childDataTableBuilders = this.createChildDataTableBuilders()\n\n const parentChildTable = parentChildKeys.flatMap((key) => {\n const sectionData = sectionedParentChildData[key.sortKey] || {}\n\n let parentSectionData: Dict<string>[] = []\n if (sectionData) {\n parentSectionData = sectionData['parent'] ? sectionData['parent'] : []\n }\n\n return [header].concat(parentSectionData.map((r) => this.mapRow(r, 'dpr-parent-cell'))).concat(\n this.childVariants\n .filter((childVariant) => sectionData && sectionData[childVariant.id])\n .map((childVariant) => {\n const builder = childDataTableBuilders[childVariant.id]\n const section = sectionData[childVariant.id]\n const dataTable = builder && section ? builder.buildTable(section) : undefined\n const dataTableHtml = dataTable ? this.convertDataTableToHtml(dataTable) : ''\n\n return [\n {\n classes: 'dpr-child-report-cell',\n format: 'string',\n html: `<div class='dpr-child-report'><h2 class=\"govuk-heading-s\">${childVariant.name}</h2><div class=\"dpr-child-report_table\">${dataTableHtml}</div></div>`,\n colspan: this.columns.length,\n },\n ]\n }),\n )\n })\n\n return parentChildTable\n }\n\n private createParentChildSectionRows(parentData: Array<Dict<string>>, header: Cell[]) {\n const sectionsDetails = this.mapSections(parentData)\n const sectionedData = sectionsDetails.sectionedData as Dict<Array<Dict<string>>>\n const sectionedParentChildSectionedRows: {\n sectionDescription: string\n rows: Cell[][]\n count: number\n countDescription: string\n }[] = []\n\n Object.keys(sectionedData).forEach((sectionDescription) => {\n const data = sectionedData[sectionDescription] as Array<Dict<string>>\n\n sectionedParentChildSectionedRows.push({\n sectionDescription,\n ...this.getSectionCount(sectionedData, sectionDescription),\n rows: this.createParentChildTable(data, header),\n })\n })\n\n const rows = sectionedParentChildSectionedRows.flatMap((section, index) => {\n const sectionHeader = this.createSectionHeader(\n section.sectionDescription,\n index,\n section.count,\n section.countDescription,\n )\n return [...sectionHeader, ...section.rows]\n })\n\n return rows\n }\n\n private mapParentChildData(parentData: Array<Dict<string>>, header: Cell[]): Cell[][] {\n if (this.sections?.length) {\n return this.createParentChildSectionRows(parentData, header)\n }\n return this.createParentChildTable(parentData, header)\n }\n\n private createChildDataTableBuilders() {\n const childDataTables: Dict<DataTableBuilder> = this.childVariants.reduce((previousValue, childVariant) => {\n const { specification } = childVariant\n const fields = specification ? specification.fields : []\n const fieldNamesToDisplay = fields.filter((f) => f.visible || f.mandatory).map((f) => f.name)\n\n const dataTableBuilder = new DataTableBuilder(fields).withNoHeaderOptions(fieldNamesToDisplay).withSortedData()\n\n return {\n ...previousValue,\n [childVariant.id]: dataTableBuilder,\n }\n }, {})\n return childDataTables\n }\n\n private calculateParentChildKeys(\n parentData: Array<NodeJS.Dict<string>>,\n joinFields: components['schemas']['FieldDefinition'][],\n ) {\n return parentData\n .map(\n (rowData): ParentChildSortKey => ({\n sortKey: this.getSortKey(rowData, joinFields),\n childSortKeys: this.childVariants.reduce((previousValue, childVariant) => {\n return {\n ...previousValue,\n [childVariant.id]: this.getSortKey(rowData, this.mapNamesToFields(childVariant.joinFields)),\n }\n }, {}),\n }),\n )\n .reduce((previousValue: ParentChildSortKey[], sortKey: ParentChildSortKey) => {\n if (previousValue.find((v) => v.sortKey === sortKey.sortKey)) {\n return previousValue\n }\n return previousValue.concat(sortKey)\n }, [])\n }\n\n private splitParentDataIntoSections(\n sectionedParentChildData: NodeJS.Dict<NodeJS.Dict<Array<NodeJS.Dict<string>>>>,\n parentData: Array<NodeJS.Dict<string>>,\n joinFields: components['schemas']['FieldDefinition'][],\n ) {\n return parentData.reduce((previousValue, rowData) => {\n const parentKey: string = this.getSortKey(rowData, joinFields)\n const previousParentValue = previousValue[parentKey] ? previousValue[parentKey]['parent'] : []\n\n return {\n ...previousValue,\n ...(previousParentValue && {\n [parentKey]: {\n parent: previousParentValue.concat(rowData),\n },\n }),\n }\n }, sectionedParentChildData)\n }\n\n private splitChildDataIntoSections(\n parentKeys: ParentChildSortKey[],\n sectionedParentChildData: Dict<Dict<Array<Dict<string>>>>,\n ): Dict<Dict<Array<Dict<string>>>> {\n const sectionedParentChildDataWithChildren = { ...sectionedParentChildData }\n\n this.childVariants.forEach((childVariant) => {\n const childFields = this.mapNamesToFields(childVariant.joinFields)\n const matchingChildData = this.childData.find((d) => d.id === childVariant.id)\n const data = matchingChildData ? matchingChildData.data : []\n\n data\n .filter((rowData) => {\n const sortKey = this.getSortKey(rowData, childFields)\n return parentKeys.find((p) => p.childSortKeys[childVariant.id] === sortKey)\n })\n .forEach((rowData) => {\n const sortKey = this.getSortKey(rowData, childFields)\n const parent = parentKeys.find((p) => p.childSortKeys[childVariant.id] === sortKey)\n const parentSortKey = parent ? parent.sortKey : ''\n const parentSection = sectionedParentChildDataWithChildren[parentSortKey]\n if (parentSection) {\n const existingChildData = parentSection[childVariant.id] || []\n parentSection[childVariant.id] = existingChildData.concat(rowData)\n }\n })\n })\n\n return sectionedParentChildDataWithChildren\n }\n\n withChildData(childData: Array<ChildData>) {\n this.childData = childData\n return this\n }\n\n override buildTable(data: Array<Dict<string>>): DataTable {\n return {\n head: null,\n rows: this.mapParentChildData(data, this.mapHeader(true, 'govuk-table__header')),\n rowCount: data.length,\n colCount: this.columns.length,\n }\n }\n}\n\nexport { ParentChildDataTableBuilder }\nexport default ParentChildDataTableBuilder\n"],
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iCAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAGA,IAAAK,EAA6B,mDAC7BC,EAAyB,yBAEzBC,EAAsC,qEAEtC,MAAML,UAAoC,EAAAM,OAA0B,
|
|
6
|
-
"names": ["ParentChildDataTableBuilder_exports", "__export", "ParentChildDataTableBuilder", "ParentChildDataTableBuilder_default", "__toCommonJS", "import_DataTableBuilder", "import_arrayUtils", "import_SectionedDataTableBuilder", "SectionedDataTableBuilder", "variant", "specification", "sections", "template", "parentData", "header", "sectionedParentChildData", "joinFields", "c", "parentChildKeys", "parentKey", "childDataTableBuilders", "key", "sectionData", "parentSectionData", "r", "childVariant", "builder", "section", "dataTable", "dataTableHtml", "sectionedData", "sectionedParentChildSectionedRows", "sectionDescription", "data", "index", "previousValue", "fields", "fieldNamesToDisplay", "f", "dataTableBuilder", "DataTableBuilder", "rowData", "sortKey", "v", "previousParentValue", "parentKeys",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AAC,GAGxD,OAAQP,GAAY,CACnB,MAAMC,EAAU,KAAK,WAAWD,EAASM,CAAW,EACpD,OAAOF,EAAW,KAAMK,GAAMA,EAAE,cAAczB,EAAa,EAAE,IAAMiB,CAAO,CAC5E,CAAC,EACA,QAASD,GAAY,CACpB,MAAMC,EAAU,KAAK,WAAWD,EAASM,CAAW,EAC9CI,EAASN,EAAW,KAAMK,GAAMA,EAAE,cAAczB,EAAa,EAAE,IAAMiB,CAAO,EAC5EU,EAAgBD,EAASA,EAAO,QAAU,GAC1CE,EAAgBP,EAAqCM,CAAa,EACxE,GAAIC,EAAe,CACjB,MAAMC,EAAoBD,EAAc5B,EAAa,EAAE,GAAK,CAAC,EAC7D4B,EAAc5B,EAAa,EAAE,EAAI6B,EAAkB,OAAOb,CAAO,CACnE,CACF,CAAC,CACL,CAAC,EAEMK,CACT,CAEA,cAAcS,EAA6B,CACzC,YAAK,UAAYA,EACV,IACT,CAES,WAAWtB,EAAsC,CACxD,MAAO,CACL,KAAM,KACN,KAAM,KAAK,mBAAmBA,EAAM,KAAK,UAAU,GAAM,qBAAqB,CAAC,EAC/E,SAAUA,EAAK,OACf,SAAU,KAAK,QAAQ,MACzB,CACF,CACF,CAGA,IAAO9B,EAAQD",
|
|
6
|
+
"names": ["ParentChildDataTableBuilder_exports", "__export", "ParentChildDataTableBuilder", "ParentChildDataTableBuilder_default", "__toCommonJS", "import_DataTableBuilder", "import_arrayUtils", "import_SectionedDataTableBuilder", "SectionedDataTableBuilder", "variant", "specification", "sections", "template", "parentData", "header", "sectionedParentChildData", "joinFields", "c", "parentChildKeys", "parentKey", "childDataTableBuilders", "key", "sectionData", "parentSectionData", "r", "childVariant", "builder", "section", "dataTable", "dataTableHtml", "sectionedData", "sectionedParentChildSectionedRows", "sectionDescription", "data", "index", "previousValue", "fields", "fieldNamesToDisplay", "f", "dataTableBuilder", "DataTableBuilder", "rowData", "sortKey", "v", "previousParentValue", "parentKeys", "sectionedParentChildDataWithChildren", "childFields", "matchingChildData", "d", "p", "parent", "parentSortKey", "parentSection", "existingChildData", "childData"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var y=Object.create;var m=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty;var v=(r,t)=>{for(var i in t)m(r,i,{get:t[i],enumerable:!0})},u=(r,t,i,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of b(t))!f.call(r,s)&&s!==i&&m(r,s,{get:()=>t[s],enumerable:!(e=C(t,s))||e.enumerable});return r};var h=(r,t,i)=>(i=r!=null?y(T(r)):{},u(t||!r||!r.__esModule?m(i,"default",{value:r,enumerable:!0}):i,r)),H=r=>u(m({},"__esModule",{value:!0}),r);var $={};v($,{SectionedDataTableBuilder:()=>p,default:()=>A});module.exports=H($);var d=h(require("../DataTableBuilder/DataTableBuilder")),S=require("../arrayUtils"),g=h(require("../SummaryDataTableBuilder/SummaryDataTableBuilder"));class p extends d.default{constructor(t){const{fields:i,sections:e,template:s}=t;super(i),this.sections=e,this.template=s}createSectionHeadings(t,i){return t.map(e=>({description:this.mapSectionDescription(e),sortKey:this.getSortKey(e,i)})).sort(this.sortKeyComparison()).map(e=>e.description).reduce(S.distinct,[])}initSectionData(t){const i={};return t.forEach(e=>{i[e]=[]}),i}mapRowsToSection(t,i){return t.reduce((e,s)=>{const n=this.mapSectionDescription(s),a=this.mapRow(s),o=e[n];return{...e,...o&&{[n]:o.concat([a])}}},i)}mapDataToSection(t,i){return t.reduce((e,s)=>{const n=this.mapSectionDescription(s),a=e[n];return{...e,...a&&{[n]:a.concat([s])}}},i)}getSectionCount(t,i){const e=t[i]?t[i].length:0,s=`${e} result${e===1?"":"s"}`;return{count:e,countDescription:s}}mapSummariesAndCreateTable(t,i,e){let s=[],n=[],a=[],o=[],c=[];return n=this.mapSectionSummaryTables(t,"section-header",this.columns.length),a=this.mapSectionSummaryRows("table-header",t),o=this.mapSectionSummaryRows("table-footer",t),c=this.mapSectionSummaryTables(t,"section-footer",this.columns.length),s=n.concat(i.length>0?[e]:[]).concat(a).concat(i).concat(o).concat(c),s}createTableContent(t,i,e){return t.flatMap((s,n)=>{const{count:a,countDescription:o}=this.getSectionCount(i,s),c=i[s];let l=[];return c&&(Object.keys(this.reportSummaries).length?l=this.mapSummariesAndCreateTable(s,c,e):l=l.concat(c.length>0?[e]:[]).concat(c)),[...this.createSectionHeader(s,n,a,o),...l]})}createSectionHeader(t,i,e,s){const n=[];return i!==0&&n.push([{classes:"dpr-section-header-spacer",colspan:this.columns.length,text:""}]),n.push([{classes:"dpr-section-header",colspan:this.columns.length,html:`<h2 class="govuk-heading-m">${t}${e&&e>0?` <span class='govuk-caption-m'>${s}</span>`:""}</h2>`}]),n.push([{classes:"dpr-section-header-spacer-bottom",colspan:this.columns.length,text:""}]),n}mapSectionSummaryRows(t,i){return this.reportSummaries[t]?this.reportSummaries[t].flatMap(e=>e.data.filter(s=>this.mapSectionDescription(s)===i).map(s=>this.mapRow(s,`dpr-report-summary-cell dpr-report-summary-cell-${t}`,e.fields))):[]}mapSectionSummaryTables(t,i,e){const s=this.reportSummaries[i];if(s){const a=s.map(o=>{const c=o.data.filter(l=>this.mapSectionDescription(l)===t);if(c.length>0){const l=new g.default(o,this.sections).buildTable(c);return`<div class='dpr-summary-container'>${this.convertDataTableToHtml(l)}</div>`}return""}).join("");if(a.length>0)return[[{classes:"dpr-summary-cell",colspan:e,html:`<div class='dpr-summary-container-group dpr-summary-container-group-${i}'>${a}</div>`}]]}return[]}mapSectionDescription(t){const{sections:i}=this;return this.mapNamesToFields(i).map(e=>`${e.display}: ${this.mapCellValue(e,t[e.name])}`).join(", ")}mapSections(t){const i=this.initSectionedHeadings(t);let{sectionedData:e}=i;return this.template!=="summary-section"&&(this.template==="parent-child-section"?e=this.mapDataToSection(t,e):e=this.mapRowsToSection(t,e)),{sectionDescriptions:i.sectionDescriptions,sectionedData:e}}initSectionedHeadings(t){const i=this.mapNamesToFields(this.sections),e=this.createSectionHeadings(t,i),s=this.initSectionData(e);return{sectionDescriptions:e,sectionedData:s}}mapSectionedData(t,i){const{sectionDescriptions:e,sectionedData:s}=this.mapSections(t);return this.createTableContent(e,s,i)}buildTable(t){return{head:null,rows:this.mapSectionedData(t,this.mapHeader(!0,"govuk-table__header")),rowCount:t.length,colCount:this.columns.length}}}var A=p;0&&(module.exports={SectionedDataTableBuilder});
|
|
1
|
+
"use strict";var y=Object.create;var m=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty;var v=(r,t)=>{for(var i in t)m(r,i,{get:t[i],enumerable:!0})},u=(r,t,i,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of b(t))!f.call(r,s)&&s!==i&&m(r,s,{get:()=>t[s],enumerable:!(e=C(t,s))||e.enumerable});return r};var h=(r,t,i)=>(i=r!=null?y(T(r)):{},u(t||!r||!r.__esModule?m(i,"default",{value:r,enumerable:!0}):i,r)),H=r=>u(m({},"__esModule",{value:!0}),r);var $={};v($,{SectionedDataTableBuilder:()=>p,default:()=>A});module.exports=H($);var d=h(require("../DataTableBuilder/DataTableBuilder")),S=require("../arrayUtils"),g=h(require("../SummaryDataTableBuilder/SummaryDataTableBuilder"));class p extends d.default{sections;template;constructor(t){const{fields:i,sections:e,template:s}=t;super(i),this.sections=e,this.template=s}createSectionHeadings(t,i){return t.map(e=>({description:this.mapSectionDescription(e),sortKey:this.getSortKey(e,i)})).sort(this.sortKeyComparison()).map(e=>e.description).reduce(S.distinct,[])}initSectionData(t){const i={};return t.forEach(e=>{i[e]=[]}),i}mapRowsToSection(t,i){return t.reduce((e,s)=>{const n=this.mapSectionDescription(s),a=this.mapRow(s),o=e[n];return{...e,...o&&{[n]:o.concat([a])}}},i)}mapDataToSection(t,i){return t.reduce((e,s)=>{const n=this.mapSectionDescription(s),a=e[n];return{...e,...a&&{[n]:a.concat([s])}}},i)}getSectionCount(t,i){const e=t[i]?t[i].length:0,s=`${e} result${e===1?"":"s"}`;return{count:e,countDescription:s}}mapSummariesAndCreateTable(t,i,e){let s=[],n=[],a=[],o=[],c=[];return n=this.mapSectionSummaryTables(t,"section-header",this.columns.length),a=this.mapSectionSummaryRows("table-header",t),o=this.mapSectionSummaryRows("table-footer",t),c=this.mapSectionSummaryTables(t,"section-footer",this.columns.length),s=n.concat(i.length>0?[e]:[]).concat(a).concat(i).concat(o).concat(c),s}createTableContent(t,i,e){return t.flatMap((s,n)=>{const{count:a,countDescription:o}=this.getSectionCount(i,s),c=i[s];let l=[];return c&&(Object.keys(this.reportSummaries).length?l=this.mapSummariesAndCreateTable(s,c,e):l=l.concat(c.length>0?[e]:[]).concat(c)),[...this.createSectionHeader(s,n,a,o),...l]})}createSectionHeader(t,i,e,s){const n=[];return i!==0&&n.push([{classes:"dpr-section-header-spacer",colspan:this.columns.length,text:""}]),n.push([{classes:"dpr-section-header",colspan:this.columns.length,html:`<h2 class="govuk-heading-m">${t}${e&&e>0?` <span class='govuk-caption-m'>${s}</span>`:""}</h2>`}]),n.push([{classes:"dpr-section-header-spacer-bottom",colspan:this.columns.length,text:""}]),n}mapSectionSummaryRows(t,i){return this.reportSummaries[t]?this.reportSummaries[t].flatMap(e=>e.data.filter(s=>this.mapSectionDescription(s)===i).map(s=>this.mapRow(s,`dpr-report-summary-cell dpr-report-summary-cell-${t}`,e.fields))):[]}mapSectionSummaryTables(t,i,e){const s=this.reportSummaries[i];if(s){const a=s.map(o=>{const c=o.data.filter(l=>this.mapSectionDescription(l)===t);if(c.length>0){const l=new g.default(o,this.sections).buildTable(c);return`<div class='dpr-summary-container'>${this.convertDataTableToHtml(l)}</div>`}return""}).join("");if(a.length>0)return[[{classes:"dpr-summary-cell",colspan:e,html:`<div class='dpr-summary-container-group dpr-summary-container-group-${i}'>${a}</div>`}]]}return[]}mapSectionDescription(t){const{sections:i}=this;return this.mapNamesToFields(i).map(e=>`${e.display}: ${this.mapCellValue(e,t[e.name])}`).join(", ")}mapSections(t){const i=this.initSectionedHeadings(t);let{sectionedData:e}=i;return this.template!=="summary-section"&&(this.template==="parent-child-section"?e=this.mapDataToSection(t,e):e=this.mapRowsToSection(t,e)),{sectionDescriptions:i.sectionDescriptions,sectionedData:e}}initSectionedHeadings(t){const i=this.mapNamesToFields(this.sections),e=this.createSectionHeadings(t,i),s=this.initSectionData(e);return{sectionDescriptions:e,sectionedData:s}}mapSectionedData(t,i){const{sectionDescriptions:e,sectionedData:s}=this.mapSections(t);return this.createTableContent(e,s,i)}buildTable(t){return{head:null,rows:this.mapSectionedData(t,this.mapHeader(!0,"govuk-table__header")),rowCount:t.length,colCount:this.columns.length}}}var A=p;0&&(module.exports={SectionedDataTableBuilder});
|
|
2
2
|
//# sourceMappingURL=SectionedDataTableBuilder.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/dpr/utils/SectionedDataTableBuilder/SectionedDataTableBuilder.ts"],
|
|
4
4
|
"sourcesContent": ["import Dict = NodeJS.Dict\nimport { components } from '../../types/api'\nimport { Cell, DataTable } from '../DataTableBuilder/types'\nimport type { SummaryTemplate, Template } from '../../types/Templates'\nimport DataTableBuilder from '../DataTableBuilder/DataTableBuilder'\nimport { distinct } from '../arrayUtils'\nimport SummaryDataTableBuilder from '../SummaryDataTableBuilder/SummaryDataTableBuilder'\nimport { SectionSortKey } from './types'\n\nclass SectionedDataTableBuilder extends DataTableBuilder {\n sections: Array<string>\n\n template: Template\n\n constructor(specification: components['schemas']['Specification']) {\n const { fields, sections, template } = specification\n super(fields)\n this.sections = sections\n this.template = template\n }\n\n /**\n * Creates the section heading strings\n *\n * @param {Dict<string>[]} data\n * @param {FieldDefinition[]} sectionFields\n * @return {*} {string[]} array of section headings\n */\n private createSectionHeadings(\n data: Dict<string>[],\n sectionFields: components['schemas']['FieldDefinition'][],\n ): string[] {\n return data\n .map(\n (rowData): SectionSortKey => ({\n description: this.mapSectionDescription(rowData),\n sortKey: this.getSortKey(rowData, sectionFields),\n }),\n )\n .sort(this.sortKeyComparison())\n .map((s) => s.description)\n .reduce(distinct, [])\n }\n\n /**\n * Initialise section heading arrays\n *\n * @private\n * @param {string[]} sectionDescriptions\n * @return {*}\n * @memberof SectionedDataTableBuilder\n */\n initSectionData(sectionDescriptions: string[]) {\n const sectionedData: Dict<Cell[][]> | Dict<Array<Dict<string>>> = {}\n sectionDescriptions.forEach((sectionDescription) => {\n sectionedData[sectionDescription] = []\n })\n return sectionedData\n }\n\n /**\n * Maps the rows to the correct section\n *\n * @private\n * @param {Array<Dict<string>>} data\n * @param {Dict<Cell[][]>} sectionedData\n * @return {*}\n * @memberof SectionedDataTableBuilder\n */\n private mapRowsToSection(data: Array<Dict<string>>, sectionedData: Dict<Cell[][]>) {\n return data.reduce((previousValue, rowData) => {\n const sectionDescription: string = this.mapSectionDescription(rowData)\n const mappedData = this.mapRow(rowData)\n const previousValueDescription = previousValue[sectionDescription]\n\n return {\n ...previousValue,\n ...(previousValueDescription && {\n [sectionDescription]: previousValueDescription.concat([mappedData]),\n }),\n }\n }, sectionedData)\n }\n\n /**\n * Maps the rows to the correct section\n *\n * @private\n * @param {Array<Dict<string>>} data\n * @param {Dict<Cell[][]>} sectionedData\n * @return {*}\n * @memberof SectionedDataTableBuilder\n */\n private mapDataToSection(data: Array<Dict<string>>, sectionedData: Dict<Array<Dict<string>>>) {\n return data.reduce((previousValue, rowData) => {\n const sectionDescription: string = this.mapSectionDescription(rowData)\n const previousValueDescription = previousValue[sectionDescription]\n const section = {\n ...previousValue,\n ...(previousValueDescription && {\n [sectionDescription]: previousValueDescription.concat([rowData]),\n }),\n }\n return section\n }, sectionedData)\n }\n\n /**\n * Gets the counts for rows in section\n *\n * @param {Dict<Cell[][]>} sectionedData\n * @param {string} sectionDescription\n * @return {*}\n * @memberof SectionedDataTableBuilder\n */\n getSectionCount(sectionedData: Dict<Cell[][]> | Dict<Dict<string>[]>, sectionDescription: string) {\n const count = sectionedData[sectionDescription] ? sectionedData[sectionDescription].length : 0\n const countDescription = `${count} result${count === 1 ? '' : 's'}`\n\n return {\n count,\n countDescription,\n }\n }\n\n /**\n * Creates the summaries and builds the table with summaries\n *\n * @private\n * @param {string} sectionDescription\n * @param {Cell[][]} mappedTableData\n * @param {Cell[]} header\n * @return {*}\n * @memberof SectionedDataTableBuilder\n */\n private mapSummariesAndCreateTable(sectionDescription: string, mappedTableData: Cell[][], header: Cell[]) {\n let tableContent: Cell[][] = []\n\n let mappedSectionHeaderSummary: Cell[][] = []\n let mappedHeaderSummary: Cell[][] = []\n let mappedFooterSummary: Cell[][] = []\n let mappedSectionFooterSummary: Cell[][] = []\n\n mappedSectionHeaderSummary = this.mapSectionSummaryTables(sectionDescription, 'section-header', this.columns.length)\n mappedHeaderSummary = this.mapSectionSummaryRows('table-header', sectionDescription)\n mappedFooterSummary = this.mapSectionSummaryRows('table-footer', sectionDescription)\n mappedSectionFooterSummary = this.mapSectionSummaryTables(sectionDescription, 'section-footer', this.columns.length)\n\n tableContent = mappedSectionHeaderSummary\n .concat(mappedTableData.length > 0 ? [header] : [])\n .concat(mappedHeaderSummary)\n .concat(mappedTableData)\n .concat(mappedFooterSummary)\n .concat(mappedSectionFooterSummary)\n\n return tableContent\n }\n\n /**\n * Creates the table data\n * - if summaries are present, includes the summaries data\n *\n * @private\n * @param {string[]} sectionDescriptions\n * @param {Dict<Cell[][]>} sectionedData\n * @param {Cell[]} header\n * @return {*}\n * @memberof SectionedDataTableBuilder\n */\n private createTableContent(sectionDescriptions: string[], sectionedData: Dict<Cell[][]>, header: Cell[]) {\n return sectionDescriptions.flatMap((sectionDescription, index) => {\n const { count, countDescription } = this.getSectionCount(sectionedData, sectionDescription)\n const mappedTableData = sectionedData[sectionDescription]\n\n let tableContent: Cell[][] = []\n if (mappedTableData) {\n if (Object.keys(this.reportSummaries).length) {\n tableContent = this.mapSummariesAndCreateTable(sectionDescription, mappedTableData, header)\n } else {\n tableContent = tableContent.concat(mappedTableData.length > 0 ? [header] : []).concat(mappedTableData)\n }\n }\n\n const sectionHeader = this.createSectionHeader(sectionDescription, index, count, countDescription)\n\n return [...sectionHeader, ...tableContent]\n })\n }\n\n createSectionHeader(sectionDescription: string, index: number, count?: number, countDescription?: string) {\n const header = []\n if (index !== 0) {\n header.push([\n {\n classes: 'dpr-section-header-spacer',\n colspan: this.columns.length,\n text: '',\n },\n ])\n }\n header.push([\n {\n classes: 'dpr-section-header',\n colspan: this.columns.length,\n html: `<h2 class=\"govuk-heading-m\">${sectionDescription}${\n count && count > 0 ? ` <span class='govuk-caption-m'>${countDescription}</span>` : ''\n }</h2>`,\n },\n ])\n header.push([\n {\n classes: 'dpr-section-header-spacer-bottom',\n colspan: this.columns.length,\n text: '',\n },\n ])\n return header\n }\n\n private mapSectionSummaryRows(template: SummaryTemplate, sectionDescription: string): Cell[][] {\n if (this.reportSummaries[template]) {\n return this.reportSummaries[template].flatMap((reportSummary) =>\n reportSummary.data\n .filter((rowData) => this.mapSectionDescription(rowData) === sectionDescription)\n .map((rowData) =>\n this.mapRow(\n rowData,\n `dpr-report-summary-cell dpr-report-summary-cell-${template}`,\n <components['schemas']['FieldDefinition'][]>reportSummary.fields,\n ),\n ),\n )\n }\n return []\n }\n\n private mapSectionSummaryTables(\n sectionDescription: string,\n summaryTemplate: SummaryTemplate,\n columnsLength: number,\n ): Cell[][] {\n const summaries = this.reportSummaries[summaryTemplate]\n if (summaries) {\n const htmlTables = summaries.map((summary) => {\n const data = summary.data.filter((row) => this.mapSectionDescription(row) === sectionDescription)\n\n if (data.length > 0) {\n const dataTable = new SummaryDataTableBuilder(summary, this.sections).buildTable(data)\n\n const htmlTable = this.convertDataTableToHtml(dataTable)\n\n return `<div class='dpr-summary-container'>${htmlTable}</div>`\n }\n return ''\n })\n\n const summaryContent = htmlTables.join('')\n if (summaryContent.length > 0) {\n return [\n [\n {\n classes: 'dpr-summary-cell',\n colspan: columnsLength,\n html: `<div class='dpr-summary-container-group dpr-summary-container-group-${summaryTemplate}'>${summaryContent}</div>`,\n },\n ],\n ]\n }\n }\n return []\n }\n\n mapSectionDescription(rowData: NodeJS.Dict<string>): string {\n const { sections } = this\n\n return this.mapNamesToFields(sections)\n .map((s) => `${s.display}: ${this.mapCellValue(s, rowData[s.name])}`)\n .join(', ')\n }\n\n mapSections(data: Array<Dict<string>>) {\n const sectionHeadings = this.initSectionedHeadings(data)\n let { sectionedData } = sectionHeadings\n\n // Maps data to sections\n if (this.template !== 'summary-section') {\n if (this.template === 'parent-child-section') {\n sectionedData = this.mapDataToSection(data, sectionedData as Dict<Dict<string>[]>)\n } else {\n sectionedData = this.mapRowsToSection(data, sectionedData as Dict<Cell[][]>)\n }\n }\n\n return {\n sectionDescriptions: sectionHeadings.sectionDescriptions,\n sectionedData,\n }\n }\n\n initSectionedHeadings(data: Array<Dict<string>>) {\n // Get the section definition data\n const sectionFields = this.mapNamesToFields(this.sections)\n // create the sectionHeadings\n const sectionDescriptions = this.createSectionHeadings(data, sectionFields)\n // init empty sections\n const sectionedData = this.initSectionData(sectionDescriptions)\n\n return {\n sectionDescriptions,\n sectionedData,\n }\n }\n\n /**\n * Creates the table rows.\n *\n * @private\n * @param {Array<Dict<string>>} data\n * @param {Cell[]} header\n * @return {*} {Cell[][]}\n * @memberof SectionedDataTableBuilder\n */\n private mapSectionedData(data: Array<Dict<string>>, header: Cell[]): Cell[][] {\n const { sectionDescriptions, sectionedData } = this.mapSections(data)\n // Create the table\n const tableContent = this.createTableContent(sectionDescriptions, sectionedData as Dict<Cell[][]>, header)\n\n return tableContent\n }\n\n override buildTable(data: Array<Dict<string>>): DataTable {\n return {\n head: null,\n rows: this.mapSectionedData(data, this.mapHeader(true, 'govuk-table__header')),\n rowCount: data.length,\n colCount: this.columns.length,\n }\n }\n}\n\nexport { SectionedDataTableBuilder }\nexport default SectionedDataTableBuilder\n"],
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GA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CAAI,EAIpE,OAFqB,KAAK,mBAAmBI,EAAqBC,EAAiCQ,CAAM,CAG3G,CAES,WAAWb,EAAsC,CACxD,MAAO,CACL,KAAM,KACN,KAAM,KAAK,iBAAiBA,EAAM,KAAK,UAAU,GAAM,qBAAqB,CAAC,EAC7E,SAAUA,EAAK,OACf,SAAU,KAAK,QAAQ,MACzB,CACF,CACF,CAGA,IAAOV,EAAQD",
|
|
6
6
|
"names": ["SectionedDataTableBuilder_exports", "__export", "SectionedDataTableBuilder", "SectionedDataTableBuilder_default", "__toCommonJS", "import_DataTableBuilder", "import_arrayUtils", "import_SummaryDataTableBuilder", "DataTableBuilder", "specification", "fields", "sections", "template", "data", "sectionFields", "rowData", "s", "sectionDescriptions", "sectionedData", "sectionDescription", "previousValue", "mappedData", "previousValueDescription", "count", "countDescription", "mappedTableData", "header", "tableContent", "mappedSectionHeaderSummary", "mappedHeaderSummary", "mappedFooterSummary", "mappedSectionFooterSummary", "index", "reportSummary", "summaryTemplate", "columnsLength", "summaries", "summaryContent", "summary", "row", "dataTable", "SummaryDataTableBuilder", "sectionHeadings"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var m=Object.create;var o=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var D=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var g=(a,i)=>{for(var t in i)o(a,t,{get:i[t],enumerable:!0})},h=(a,i,t,d)=>{if(i&&typeof i=="object"||typeof i=="function")for(let e of u(i))!F.call(a,e)&&e!==t&&o(a,e,{get:()=>i[e],enumerable:!(d=f(i,e))||d.enumerable});return a};var y=(a,i,t)=>(t=a!=null?m(D(a)):{},h(i||!a||!a.__esModule?o(t,"default",{value:a,enumerable:!0}):t,a)),C=a=>h(o({},"__esModule",{value:!0}),a);var T={};g(T,{SectionedFieldsDataTableBuilder:()=>c,default:()=>S});module.exports=C(T);var p=y(require("../ParentChildDataTableBuilder/ParentChildDataTableBuilder"));class c extends p.default{constructor(i){const{sectionedFields:t,template:d}=i.specification;super(i),this.sectionedFields=t,this.sections=this.sectionedFields.map(e=>e.name),this.template=d,this.childVariants=this.variant.childVariants||[]}getChildFields(i){const t=this.childVariants.find(e=>e.id===i);let d=[];if(t){const{specification:e}=t;d=e?e.fields:d}return d}getJoinKey(){return this.childVariants[0].joinFields[0]}initSectionedData(i){return i.flatMap(t=>this.sectionedFields.map(e=>{const s=this.mapNamesToFields([e.name])[0];let n=[];const{child:
|
|
1
|
+
"use strict";var m=Object.create;var o=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var D=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var g=(a,i)=>{for(var t in i)o(a,t,{get:i[t],enumerable:!0})},h=(a,i,t,d)=>{if(i&&typeof i=="object"||typeof i=="function")for(let e of u(i))!F.call(a,e)&&e!==t&&o(a,e,{get:()=>i[e],enumerable:!(d=f(i,e))||d.enumerable});return a};var y=(a,i,t)=>(t=a!=null?m(D(a)):{},h(i||!a||!a.__esModule?o(t,"default",{value:a,enumerable:!0}):t,a)),C=a=>h(o({},"__esModule",{value:!0}),a);var T={};g(T,{SectionedFieldsDataTableBuilder:()=>c,default:()=>S});module.exports=C(T);var p=y(require("../ParentChildDataTableBuilder/ParentChildDataTableBuilder"));class c extends p.default{sectionedFields;constructor(i){const{sectionedFields:t,template:d}=i.specification;super(i),this.sectionedFields=t,this.sections=this.sectionedFields.map(e=>e.name),this.template=d,this.childVariants=this.variant.childVariants||[]}getChildFields(i){const t=this.childVariants.find(e=>e.id===i);let d=[];if(t){const{specification:e}=t;d=e?e.fields:d}return d}getJoinKey(){return this.childVariants[0].joinFields[0]}initSectionedData(i){return i.flatMap(t=>this.sectionedFields.map(e=>{const s=this.mapNamesToFields([e.name])[0];let n=[];const{child:r}=e;return e.fields?n=this.mapNamesToFields(e.fields):e.child&&(n=this.getChildFields(e.child)),{header:s,fields:n,child:r}}).map(e=>{if(e.child){const s=this.getChildData(e.child),n=e.fields.filter(l=>l.visible),r=this.getJoinKey();return{header:e.header.display,fields:s?s.data.filter(l=>l[r]===t[r]).map(l=>({heading:l[n[0]?.name]||"Not found",data:l[n[1]?.name]||"Not found"})):[]}}return{header:e.header.display,fields:e.fields.filter(s=>s.visible).map(s=>({heading:s.display,data:t[s.name]}))}}))}getChildData(i){return this.childData.find(t=>t.id===i)}createRows(i){return this.initSectionedData(i).flatMap((e,s)=>{let n=[];e.header&&(n=this.createSectionHeader(e.header,s));const r=e.fields.map(l=>[{text:l.heading,classes:"dpr-row-heading"},{text:l.data,classes:"dpr-row-heading-data"}]);return[...n,...r]})}buildTable(i){return{head:[],rows:this.createRows(i),rowCount:i.length,colCount:this.columns.length}}}var S=c;0&&(module.exports={SectionedFieldsDataTableBuilder});
|
|
2
2
|
//# sourceMappingURL=SectionedFieldsTableBuilder.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/dpr/utils/SectionedFieldsTableBuilder/SectionedFieldsTableBuilder.ts"],
|
|
4
|
-
"sourcesContent": ["import Dict = NodeJS.Dict\nimport { components } from '../../types/api'\nimport { Cell, DataTable, FieldDefinition } from '../DataTableBuilder/types'\nimport type { Template } from '../../types/Templates'\nimport ParentChildDataTableBuilder from '../ParentChildDataTableBuilder/ParentChildDataTableBuilder'\n\nexport interface SectionedField {\n name: string\n fields?: string[]\n child?: string\n}\n\nclass SectionedFieldsDataTableBuilder extends ParentChildDataTableBuilder {\n // TODO: change this to use schema type if ever implemented in the backend\n sectionedFields: SectionedField[]\n\n
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qCAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAIA,IAAAK,EAAwC,yEAQxC,MAAMH,UAAwC,EAAAI,OAA4B,
|
|
4
|
+
"sourcesContent": ["import Dict = NodeJS.Dict\nimport { components } from '../../types/api'\nimport { Cell, DataTable, FieldDefinition } from '../DataTableBuilder/types'\nimport type { Template } from '../../types/Templates'\nimport ParentChildDataTableBuilder from '../ParentChildDataTableBuilder/ParentChildDataTableBuilder'\n\nexport interface SectionedField {\n name: string\n fields?: string[]\n child?: string\n}\n\nclass SectionedFieldsDataTableBuilder extends ParentChildDataTableBuilder {\n // TODO: change this to use schema type if ever implemented in the backend\n sectionedFields: SectionedField[]\n\n declare template: Template\n\n declare childVariants: components['schemas']['ChildVariantDefinition'][]\n\n constructor(variant: components['schemas']['VariantDefinition']) {\n // TODO: removed the union if sectionedFields changed to use schema type\n const { sectionedFields, template } = variant.specification as components['schemas']['Specification'] & {\n sectionedFields: SectionedField[]\n }\n super(variant)\n\n this.sectionedFields = sectionedFields\n this.sections = this.sectionedFields.map((f) => f.name)\n this.template = template\n this.childVariants = this.variant.childVariants || []\n }\n\n getChildFields(childId: string): FieldDefinition[] {\n const childVariant = this.childVariants.find((child) => child.id === childId)\n let fields: FieldDefinition[] = []\n if (childVariant) {\n const { specification } = childVariant\n fields = specification ? specification.fields : fields\n }\n return fields\n }\n\n getJoinKey() {\n return this.childVariants[0].joinFields[0]\n }\n\n initSectionedData(data: Array<Dict<string>>) {\n return data.flatMap((row) => {\n const initialisedSectionsWithFields = this.sectionedFields.map((section) => {\n const sectionHeader = this.mapNamesToFields([section.name])[0]\n\n let fields: FieldDefinition[] = []\n const { child } = section\n\n if (section.fields) {\n fields = this.mapNamesToFields(section.fields)\n } else if (section.child) {\n fields = this.getChildFields(section.child)\n }\n\n return {\n header: sectionHeader,\n fields,\n child,\n }\n })\n\n return initialisedSectionsWithFields.map((section) => {\n if (section.child) {\n const childData = this.getChildData(section.child)\n const displayFields = section.fields.filter((f) => f.visible)\n const joinKey = this.getJoinKey()\n\n return {\n header: section.header.display,\n fields: childData\n ? childData.data\n .filter((cd) => cd[joinKey] === row[joinKey])\n .map((cd) => {\n return {\n heading: cd[displayFields[0]?.name] || 'Not found',\n data: cd[displayFields[1]?.name] || 'Not found',\n }\n })\n : [],\n }\n }\n return {\n header: section.header.display,\n fields: section.fields\n .filter((f) => f.visible)\n .map((f) => {\n return {\n heading: f.display,\n data: row[f.name],\n }\n }),\n }\n })\n })\n }\n\n getChildData(childId: string) {\n return this.childData.find((d) => d.id === childId)\n }\n\n createRows(data: Array<Dict<string>>): Cell[][] {\n const sectionedData = this.initSectionedData(data)\n\n const rows = sectionedData.flatMap((section, index) => {\n let sectionHeaderRow: Cell[][] = []\n if (section.header) {\n sectionHeaderRow = this.createSectionHeader(section.header, index)\n }\n\n const sectionRows = section.fields.map((field) => {\n return [\n {\n text: field.heading,\n classes: 'dpr-row-heading',\n },\n {\n text: field.data,\n classes: 'dpr-row-heading-data',\n },\n ]\n })\n\n return [...sectionHeaderRow, ...sectionRows]\n })\n\n return rows\n }\n\n override buildTable(data: Array<Dict<string>>): DataTable {\n return {\n head: [\n // { text: '', classes: 'dpr-row-section-header' },\n // { text: '', classes: 'dpr-row-section-header-value' },\n ],\n rows: this.createRows(data),\n rowCount: data.length,\n colCount: this.columns.length,\n }\n }\n}\n\nexport { SectionedFieldsDataTableBuilder }\nexport default SectionedFieldsDataTableBuilder\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qCAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAIA,IAAAK,EAAwC,yEAQxC,MAAMH,UAAwC,EAAAI,OAA4B,CAExE,gBAMA,YAAYC,EAAqD,CAE/D,KAAM,CAAE,gBAAAC,EAAiB,SAAAC,CAAS,EAAIF,EAAQ,cAG9C,MAAMA,CAAO,EAEb,KAAK,gBAAkBC,EACvB,KAAK,SAAW,KAAK,gBAAgB,IAAKE,GAAMA,EAAE,IAAI,EACtD,KAAK,SAAWD,EAChB,KAAK,cAAgB,KAAK,QAAQ,eAAiB,CAAC,CACtD,CAEA,eAAeE,EAAoC,CACjD,MAAMC,EAAe,KAAK,cAAc,KAAMC,GAAUA,EAAM,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CACL,CACF,CAAC,CACF,CACH,CAEA,aAAaC,EAAiB,CAC5B,OAAO,KAAK,UAAU,KAAMa,GAAMA,EAAE,KAAOb,CAAO,CACpD,CAEA,WAAWK,EAAqC,CAyB9C,OAxBsB,KAAK,kBAAkBA,CAAI,EAEtB,QAAQ,CAACE,EAASO,IAAU,CACrD,IAAIC,EAA6B,CAAC,EAC9BR,EAAQ,SACVQ,EAAmB,KAAK,oBAAoBR,EAAQ,OAAQO,CAAK,GAGnE,MAAME,EAAcT,EAAQ,OAAO,IAAKU,GAC/B,CACL,CACE,KAAMA,EAAM,QACZ,QAAS,iBACX,EACA,CACE,KAAMA,EAAM,KACZ,QAAS,sBACX,CACF,CACD,EAED,MAAO,CAAC,GAAGF,EAAkB,GAAGC,CAAW,CAC7C,CAAC,CAGH,CAES,WAAWX,EAAsC,CACxD,MAAO,CACL,KAAM,CAGN,EACA,KAAM,KAAK,WAAWA,CAAI,EAC1B,SAAUA,EAAK,OACf,SAAU,KAAK,QAAQ,MACzB,CACF,CACF,CAGA,IAAOb,EAAQD",
|
|
6
6
|
"names": ["SectionedFieldsTableBuilder_exports", "__export", "SectionedFieldsDataTableBuilder", "SectionedFieldsTableBuilder_default", "__toCommonJS", "import_ParentChildDataTableBuilder", "ParentChildDataTableBuilder", "variant", "sectionedFields", "template", "f", "childId", "childVariant", "child", "fields", "specification", "data", "row", "section", "sectionHeader", "childData", "displayFields", "joinKey", "cd", "d", "index", "sectionHeaderRow", "sectionRows", "field"]
|
|
7
7
|
}
|
|
@@ -14,9 +14,9 @@ class SectionedFieldsDataTableBuilder extends ParentChildDataTableBuilder {
|
|
|
14
14
|
// TODO: change this to use schema type if ever implemented in the backend
|
|
15
15
|
sectionedFields: SectionedField[]
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
declare template: Template
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
declare childVariants: components['schemas']['ChildVariantDefinition'][]
|
|
20
20
|
|
|
21
21
|
constructor(variant: components['schemas']['VariantDefinition']) {
|
|
22
22
|
// TODO: removed the union if sectionedFields changed to use schema type
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var n=Object.create;var l=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty;var y=(a,e)=>{for(var r in e)l(a,r,{get:e[r],enumerable:!0})},o=(a,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of d(e))!p.call(a,t)&&t!==r&&l(a,t,{get:()=>e[t],enumerable:!(s=c(e,t))||s.enumerable});return a};var b=(a,e,r)=>(r=a!=null?n(f(a)):{},o(e||!a||!a.__esModule?l(r,"default",{value:a,enumerable:!0}):r,a)),T=a=>o(l({},"__esModule",{value:!0}),a);var S={};y(S,{SummaryDataTableBuilder:()=>i,default:()=>D});module.exports=T(S);var u=b(require("../DataTableBuilder/DataTableBuilder"));class i extends u.default{constructor(e,r){const s=e.fields.filter(m=>!r||!r.includes(m.name)).map(m=>m.name),t=e.fields.map(m=>({...m,calculated:!1,sortable:!1,defaultsort:!1,mandatory:!0,visible:!0}));super(t,!0),this.summary=e,this.columns=s}buildSummaryTable(){return super.buildTable(this.summary.data)}}var D=i;0&&(module.exports={SummaryDataTableBuilder});
|
|
1
|
+
"use strict";var n=Object.create;var l=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty;var y=(a,e)=>{for(var r in e)l(a,r,{get:e[r],enumerable:!0})},o=(a,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of d(e))!p.call(a,t)&&t!==r&&l(a,t,{get:()=>e[t],enumerable:!(s=c(e,t))||s.enumerable});return a};var b=(a,e,r)=>(r=a!=null?n(f(a)):{},o(e||!a||!a.__esModule?l(r,"default",{value:a,enumerable:!0}):r,a)),T=a=>o(l({},"__esModule",{value:!0}),a);var S={};y(S,{SummaryDataTableBuilder:()=>i,default:()=>D});module.exports=T(S);var u=b(require("../DataTableBuilder/DataTableBuilder"));class i extends u.default{summary;constructor(e,r){const s=e.fields.filter(m=>!r||!r.includes(m.name)).map(m=>m.name),t=e.fields.map(m=>({...m,calculated:!1,sortable:!1,defaultsort:!1,mandatory:!0,visible:!0}));super(t,!0),this.summary=e,this.columns=s}buildSummaryTable(){return super.buildTable(this.summary.data)}}var D=i;0&&(module.exports={SummaryDataTableBuilder});
|
|
2
2
|
//# sourceMappingURL=SummaryDataTableBuilder.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/dpr/utils/SummaryDataTableBuilder/SummaryDataTableBuilder.ts"],
|
|
4
4
|
"sourcesContent": ["import { components } from '../../types/api'\nimport { AsyncSummary } from '../../types/UserReports'\nimport DataTableBuilder from '../DataTableBuilder/DataTableBuilder'\nimport { DataTable } from '../DataTableBuilder/types'\n\nclass SummaryDataTableBuilder extends DataTableBuilder {\n private summary: AsyncSummary\n\n constructor(summary: AsyncSummary, sections?: Array<string>) {\n const columns = summary.fields\n .filter((field) => !sections || !sections.includes(field.name))\n .map((field) => field.name)\n\n const fields = summary.fields.map((field) => ({\n ...field,\n calculated: false,\n sortable: false,\n defaultsort: false,\n mandatory: true,\n visible: true,\n }))\n\n super(<components['schemas']['FieldDefinition'][]>fields, true)\n\n this.summary = summary\n this.columns = columns\n }\n\n buildSummaryTable(): DataTable {\n return super.buildTable(this.summary.data)\n }\n}\n\nexport { SummaryDataTableBuilder }\nexport default SummaryDataTableBuilder\n"],
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAEA,IAAAK,EAA6B,mDAG7B,MAAMH,UAAgC,EAAAI,OAAiB,
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAEA,IAAAK,EAA6B,mDAG7B,MAAMH,UAAgC,EAAAI,OAAiB,CAC7C,QAER,YAAYC,EAAuBC,EAA0B,CAC3D,MAAMC,EAAUF,EAAQ,OACrB,OAAQG,GAAU,CAACF,GAAY,CAACA,EAAS,SAASE,EAAM,IAAI,CAAC,EAC7D,IAAKA,GAAUA,EAAM,IAAI,EAEtBC,EAASJ,EAAQ,OAAO,IAAKG,IAAW,CAC5C,GAAGA,EACH,WAAY,GACZ,SAAU,GACV,YAAa,GACb,UAAW,GACX,QAAS,EACX,EAAE,EAEF,MAAkDC,EAAQ,EAAI,EAE9D,KAAK,QAAUJ,EACf,KAAK,QAAUE,CACjB,CAEA,mBAA+B,CAC7B,OAAO,MAAM,WAAW,KAAK,QAAQ,IAAI,CAC3C,CACF,CAGA,IAAON,EAAQD",
|
|
6
6
|
"names": ["SummaryDataTableBuilder_exports", "__export", "SummaryDataTableBuilder", "SummaryDataTableBuilder_default", "__toCommonJS", "import_DataTableBuilder", "DataTableBuilder", "summary", "sections", "columns", "field", "fields"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var I=Object.create;var u=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var R=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty;var f=(r,t)=>{for(var e in t)u(r,e,{get:t[e],enumerable:!0})},d=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of y(t))!g.call(r,s)&&s!==e&&u(r,s,{get:()=>t[s],enumerable:!(i=D(t,s))||i.enumerable});return r};var q=(r,t,e)=>(e=r!=null?I(R(r)):{},d(t||!r||!r.__esModule?u(e,"default",{value:r,enumerable:!0}):e,r)),U=r=>d(u({},"__esModule",{value:!0}),r);var b={};f(b,{UserStoreItemBuilder:()=>h,default:()=>E});module.exports=U(b);var p=q(require("parseurl")),o=require("../types/UserReports");class h{constructor(t,e){this.build=()=>this.userStoreItem;
|
|
1
|
+
"use strict";var I=Object.create;var u=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var R=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty;var f=(r,t)=>{for(var e in t)u(r,e,{get:t[e],enumerable:!0})},d=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of y(t))!g.call(r,s)&&s!==e&&u(r,s,{get:()=>t[s],enumerable:!(i=D(t,s))||i.enumerable});return r};var q=(r,t,e)=>(e=r!=null?I(R(r)):{},d(t||!r||!r.__esModule?u(e,"default",{value:r,enumerable:!0}):e,r)),U=r=>d(u({},"__esModule",{value:!0}),r);var b={};f(b,{UserStoreItemBuilder:()=>h,default:()=>E});module.exports=U(b);var p=q(require("parseurl")),o=require("../types/UserReports");class h{userStoreItem;requestFormData;constructor(t,e){this.requestFormData=e||{},this.userStoreItem=this.addReportData(t)}build=()=>this.userStoreItem;addReportData=({type:t,reportId:e,reportName:i,description:s,id:m,name:n})=>({type:t,reportId:e,reportName:i,description:s,id:m,name:n,timestamp:{}});addExecutionData=t=>(this.userStoreItem={...this.userStoreItem,...t},this);addChildExecutionData=t=>(this.userStoreItem={...this.userStoreItem,childExecutionData:t},this);addFilters=t=>{const e=new URLSearchParams(t).toString();return this.userStoreItem={...this.userStoreItem,filters:{data:t,queryString:e}},this};addSortData=t=>{const e=new URLSearchParams(t).toString();return this.userStoreItem={...this.userStoreItem,sortBy:{data:t,queryString:e}},this};addRequestUrls=t=>{const{origin:e,pathname:i,search:s,href:m}=this.requestFormData,{executionId:n,dataProductDefinitionsPath:S,dpdPathFromQuery:l}=this.userStoreItem;let a=t.baseUrl.replace("/filters",`/${n}/status`);l&&(a=`${a}?dataProductDefinitionsPath=${S}`);const c=`${e}${a}`;return this.userStoreItem={...this.userStoreItem,url:{origin:e,request:{fullUrl:m,pathname:i,search:s},polling:{fullUrl:c,pathname:a}}},this};addAsyncUrls=t=>(t&&(this.userStoreItem={...this.userStoreItem,url:t}),this);addReportUrls=t=>{const e=t.get("host"),i=`${t.protocol}://${t.get("host")}${t.originalUrl}`,s=(0,p.default)(t);return this.userStoreItem={...this.userStoreItem,url:{origin:e||this.userStoreItem.url?.origin||"",...this.userStoreItem.url?.request&&{request:this.userStoreItem.url.request},...this.userStoreItem.url?.polling&&{polling:this.userStoreItem.url.polling},report:{...this.userStoreItem.url?.report&&this.userStoreItem.url.report,fullUrl:i,...s&&s.search&&{search:s.search}}}},this};addLoadType=t=>(this.userStoreItem={...this.userStoreItem,loadType:t},this);addQuery=t=>(this.userStoreItem={...this.userStoreItem,...t&&{query:{data:t.query,summary:t.querySummary}}},this);addInteractiveQuery=t=>(t&&(this.userStoreItem={...this.userStoreItem,interactiveQuery:{data:t.query,summary:t.querySummary}}),this);addStatus=t=>(this.userStoreItem={...this.userStoreItem,status:t},this);addMetrics=t=>(this.userStoreItem={...this.userStoreItem,metrics:t.filter(e=>e.display).map(e=>({name:e.display||""}))},this);addTimestamp=()=>{const{status:t}=this.userStoreItem,e=new Date;switch(t){case o.RequestStatus.FAILED:this.userStoreItem.timestamp.failed=e;break;case o.RequestStatus.EXPIRED:this.userStoreItem.timestamp.expired=e;break;case o.RequestStatus.ABORTED:this.userStoreItem.timestamp.aborted=e;break;case o.RequestStatus.FINISHED:this.userStoreItem.timestamp.completed=e;break;case o.RequestStatus.SUBMITTED:this.userStoreItem.timestamp.requested=e;break;case o.RequestStatus.STARTED:case o.RequestStatus.PICKED:break;default:this.userStoreItem.timestamp.lastViewed=e;break}return this};addDefinitionsPath=(t,e)=>(t&&(this.userStoreItem={...this.userStoreItem,dataProductDefinitionsPath:t,dpdPathFromQuery:e}),this)}var E=h;0&&(module.exports={UserStoreItemBuilder});
|
|
2
2
|
//# sourceMappingURL=UserStoreItemBuilder.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/dpr/utils/UserStoreItemBuilder.ts"],
|
|
4
4
|
"sourcesContent": ["import type { Request } from 'express'\nimport parseUrl from 'parseurl'\nimport {\n AsyncReportUrlData,\n LoadType,\n ReportType,\n RequestedReport,\n RequestFormData,\n RequestStatus,\n UserReportData,\n} from '../types/UserReports'\nimport Dict = NodeJS.Dict\nimport { ChildReportExecutionData, ExecutionData } from '../types/ExecutionData'\nimport { components } from '../types/api'\n\ninterface ReportData {\n type: ReportType\n reportId: string\n reportName: string\n description: string\n id: string\n name: string\n}\n\nclass UserStoreItemBuilder {\n userStoreItem: UserReportData\n\n requestFormData: RequestFormData | Record<string, never>\n\n constructor(reportData: ReportData, requestFormData?: RequestFormData) {\n this.requestFormData = requestFormData || {}\n this.userStoreItem = this.addReportData(reportData)\n }\n\n build = () => {\n return this.userStoreItem as RequestedReport\n }\n\n addReportData = ({ type, reportId, reportName, description, id, name }: ReportData) => {\n return {\n type: type as ReportType,\n reportId,\n reportName,\n description,\n id,\n name,\n timestamp: {},\n }\n }\n\n addExecutionData = (executionData: ExecutionData) => {\n this.userStoreItem = {\n ...(<UserReportData>this.userStoreItem),\n ...executionData,\n }\n return this\n }\n\n addChildExecutionData = (childExecutionData: Array<ChildReportExecutionData>) => {\n this.userStoreItem = {\n ...(<UserReportData>this.userStoreItem),\n childExecutionData,\n }\n return this\n }\n\n addFilters = (filterData?: Record<string, string>) => {\n const filtersQueryString = new URLSearchParams(filterData).toString()\n this.userStoreItem = {\n ...this.userStoreItem,\n ...{\n filters: {\n data: filterData,\n queryString: filtersQueryString,\n },\n },\n }\n return this\n }\n\n addSortData = (sortData?: Record<string, string>) => {\n const sortByQueryString = new URLSearchParams(sortData).toString()\n this.userStoreItem = {\n ...this.userStoreItem,\n ...{\n sortBy: {\n data: sortData,\n queryString: sortByQueryString,\n },\n },\n }\n return this\n }\n\n addRequestUrls = (req: Request) => {\n const { origin, pathname, search, href } = this.requestFormData\n const { executionId, dataProductDefinitionsPath, dpdPathFromQuery } = this.userStoreItem\n\n // Polling path\n let pollingPath = req.baseUrl.replace('/filters', `/${executionId}/status`)\n if (dpdPathFromQuery) {\n pollingPath = `${pollingPath}?dataProductDefinitionsPath=${dataProductDefinitionsPath}`\n }\n const pollingFullUrl = `${origin}${pollingPath}`\n this.userStoreItem = {\n ...this.userStoreItem,\n ...{\n url: {\n origin,\n request: {\n fullUrl: href,\n pathname,\n search,\n },\n polling: {\n fullUrl: pollingFullUrl,\n pathname: pollingPath,\n },\n },\n },\n }\n\n return this\n }\n\n addAsyncUrls = (url?: AsyncReportUrlData) => {\n if (url) {\n this.userStoreItem = {\n ...this.userStoreItem,\n ...{\n url,\n },\n }\n }\n\n return this\n }\n\n addReportUrls = (req: Request) => {\n const origin = req.get('host')\n const fullUrl = `${req.protocol}://${req.get('host')}${req.originalUrl}`\n const urlData = parseUrl(req)\n\n this.userStoreItem = {\n ...this.userStoreItem,\n ...{\n url: {\n origin: origin || this.userStoreItem.url?.origin || '',\n ...(this.userStoreItem.url?.request && { request: this.userStoreItem.url.request }),\n ...(this.userStoreItem.url?.polling && { polling: this.userStoreItem.url.polling }),\n report: {\n ...(this.userStoreItem.url?.report && this.userStoreItem.url.report),\n fullUrl,\n ...(urlData && urlData.search && { search: urlData.search }),\n },\n },\n },\n }\n\n return this\n }\n\n addLoadType = (loadType: LoadType) => {\n this.userStoreItem = {\n ...this.userStoreItem,\n loadType,\n }\n\n return this\n }\n\n addQuery = (queryData?: { query: Dict<string | string[]>; querySummary: Array<Dict<string>> }) => {\n this.userStoreItem = {\n ...this.userStoreItem,\n ...(queryData && {\n query: {\n data: queryData.query,\n summary: queryData.querySummary,\n },\n }),\n }\n return this\n }\n\n addInteractiveQuery = (queryData?: { query: Dict<string | string[]>; querySummary: Array<Dict<string>> }) => {\n if (queryData) {\n this.userStoreItem = {\n ...this.userStoreItem,\n ...{\n interactiveQuery: {\n data: queryData.query,\n summary: queryData.querySummary,\n },\n },\n }\n }\n return this\n }\n\n addStatus = (status: RequestStatus) => {\n this.userStoreItem = {\n ...this.userStoreItem,\n status,\n }\n return this\n }\n\n addMetrics = (metrics: components['schemas']['DashboardSectionDefinition'][]) => {\n this.userStoreItem = {\n ...this.userStoreItem,\n metrics: metrics.filter((metric) => metric.display).map((metric) => ({ name: metric.display || '' })),\n }\n return this\n }\n\n addTimestamp = () => {\n const { status } = this.userStoreItem\n const ts = new Date()\n switch (status) {\n case RequestStatus.FAILED:\n this.userStoreItem.timestamp.failed = ts\n break\n case RequestStatus.EXPIRED:\n this.userStoreItem.timestamp.expired = ts\n break\n case RequestStatus.ABORTED:\n this.userStoreItem.timestamp.aborted = ts\n break\n case RequestStatus.FINISHED:\n this.userStoreItem.timestamp.completed = ts\n break\n case RequestStatus.SUBMITTED:\n this.userStoreItem.timestamp.requested = ts\n break\n case RequestStatus.STARTED:\n case RequestStatus.PICKED:\n break\n default:\n this.userStoreItem.timestamp.lastViewed = ts\n break\n }\n return this\n }\n\n addDefinitionsPath = (definitionsPath: string, dpdPathFromQuery: boolean) => {\n if (definitionsPath) {\n this.userStoreItem = {\n ...this.userStoreItem,\n dataProductDefinitionsPath: definitionsPath,\n dpdPathFromQuery,\n }\n }\n return this\n }\n}\n\nexport { UserStoreItemBuilder }\nexport default UserStoreItemBuilder\n"],
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GACA,IAAAK,EAAqB,uBACrBC,EAQO,gCAcP,MAAMJ,CAAqB,
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GACA,IAAAK,EAAqB,uBACrBC,EAQO,gCAcP,MAAMJ,CAAqB,CACzB,cAEA,gBAEA,YAAYK,EAAwBC,EAAmC,CACrE,KAAK,gBAAkBA,GAAmB,CAAC,EAC3C,KAAK,cAAgB,KAAK,cAAcD,CAAU,CACpD,CAEA,MAAQ,IACC,KAAK,cAGd,cAAgB,CAAC,CAAE,KAAAE,EAA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,CAAO,EAAI,KAAK,cAClBG,EAAK,IAAI,KACf,OAAQH,EAAQ,CACd,KAAK,gBAAc,OACjB,KAAK,cAAc,UAAU,OAASG,EACtC,MACF,KAAK,gBAAc,QACjB,KAAK,cAAc,UAAU,QAAUA,EACvC,MACF,KAAK,gBAAc,QACjB,KAAK,cAAc,UAAU,QAAUA,EACvC,MACF,KAAK,gBAAc,SACjB,KAAK,cAAc,UAAU,UAAYA,EACzC,MACF,KAAK,gBAAc,UACjB,KAAK,cAAc,UAAU,UAAYA,EACzC,MACF,KAAK,gBAAc,QACnB,KAAK,gBAAc,OACjB,MACF,QACE,KAAK,cAAc,UAAU,WAAaA,EAC1C,KACJ,CACA,OAAO,IACT,EAEA,mBAAqB,CAACC,EAAyBb,KACzCa,IACF,KAAK,cAAgB,CACnB,GAAG,KAAK,cACR,2BAA4BA,EAC5B,iBAAAb,CACF,GAEK,KAEX,CAGA,IAAOzB,EAAQD",
|
|
6
6
|
"names": ["UserStoreItemBuilder_exports", "__export", "UserStoreItemBuilder", "UserStoreItemBuilder_default", "__toCommonJS", "import_parseurl", "import_UserReports", "reportData", "requestFormData", "type", "reportId", "reportName", "description", "id", "name", "executionData", "childExecutionData", "filterData", "filtersQueryString", "sortData", "sortByQueryString", "req", "origin", "pathname", "search", "href", "executionId", "dataProductDefinitionsPath", "dpdPathFromQuery", "pollingPath", "pollingFullUrl", "url", "fullUrl", "urlData", "parseUrl", "loadType", "queryData", "status", "metrics", "metric", "ts", "definitionsPath"]
|
|
7
7
|
}
|