UNPKG

@ministryofjustice/hmpps-digital-prison-reporting-frontend

Version:

The Digital Prison Reporting Frontend contains templates and code to help display data effectively in UI applications.

44 lines (43 loc) 2.08 kB
import Dict = NodeJS.Dict; import ReportQuery from '../../types/ReportQuery'; import { Cell, DataTable, SortKey } from './types'; import { AsyncSummary } from '../../types/UserReports'; import { components } from '../../types/api'; declare class DataTableBuilder { protected fields: components['schemas']['FieldDefinition'][]; private sortData; protected columns: Array<string>; protected reportSummaries: Dict<Array<AsyncSummary>>; private reportQuery; private currentQueryParams; private dateMapper; constructor(fields: components['schemas']['FieldDefinition'][], sortData?: boolean); private mapDate; private mapBoolean; protected mapRow(rowData: NodeJS.Dict<string>, extraClasses?: string, overrideFields?: components['schemas']['FieldDefinition'][]): Cell[]; private mapCell; protected mapCellValue(field: components['schemas']['FieldDefinition'], cellData?: string): string | undefined; protected mapHeader(): Cell[]; protected mapData(data: Array<Dict<string>>): Cell[][]; private mergeCells; private getCellByFieldName; private mapSummary; protected sort(data: Dict<string>[]): Dict<string>[]; protected sortKeyComparison(): (a: SortKey, b: SortKey) => 0 | 1 | -1; private appendSortKeyToData; protected mapNamesToFields(names: string[]): components['schemas']['FieldDefinition'][]; protected getSortKey(rowData: NodeJS.Dict<string>, sortFields: components['schemas']['FieldDefinition'][]): string; protected convertDataTableToHtml(dataTable: DataTable): string; withHeaderOptions({ reportQuery, columns, interactive, }: { reportQuery?: ReportQuery; columns: string[]; interactive: boolean; }): this; withHeaderSortOptions(reportQuery: ReportQuery): this; withNoHeaderOptions(columns: string[]): this; buildTable(data: Array<Dict<string>>): DataTable; withSummaries(reportSummaries: Dict<Array<AsyncSummary>>): this; withSortedData(sortData?: boolean): this; } export { DataTableBuilder }; export default DataTableBuilder;