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: string, label: string, columnClass: string) {\r\n this.id = id;\r\n this.label = label;\r\n this.class = columnClass;\r\n }\r\n id: string;\r\n label: string;\r\n class: string;\r\n}\r\n","import $ from \"jquery\";\r\n\r\nimport { HeaderModel } from \"../HeaderModel\";\r\nimport { mhaStrings } from \"../mhaStrings\";\r\nimport { OtherRow } from \"../row/OtherRow\";\r\nimport { ReceivedRow } from \"../row/ReceivedRow\";\r\nimport { Row } from \"../row/Row\";\r\nimport { Column } from \"../table/Column\";\r\nimport { ITable } from \"../table/ITable\";\r\n\r\ntype Binding = {\r\n name: string;\r\n visible: (table: Table) => boolean;\r\n}\r\n\r\nexport class Table {\r\n private viewModel: HeaderModel = {};\r\n private showExtra = false;\r\n\r\n private visibilityBindings: Binding[] = [\r\n { name: \"#lineBreak\", visible: function (table: Table) { return table.viewModel.hasData; } },\r\n { name: \"#response\", visible: function (table: Table) { return table.viewModel.hasData; } },\r\n { name: \"#status\", visible: function (table: Table) { return !!table.viewModel.status; } },\r\n { name: \".extraCol\", visible: function (table: Table) { return table.showExtra; } },\r\n { name: \"#clearButton\", visible: function (table: Table) { return table.viewModel.hasData; } },\r\n { name: \"#copyButton\", visible: function (table: Table) { return table.viewModel.hasData; } }\r\n ];\r\n\r\n // Adjusts response under our lineBreak\r\n private positionResponse(): void {\r\n const lineBreak = $(\"#lineBreak\");\r\n if (lineBreak && lineBreak[0]) {\r\n const responseTop: number = lineBreak[0]?.offsetTop + (lineBreak.height() ?? 0);\r\n $(\"#response\").css(\"top\", responseTop + 15);\r\n }\r\n }\r\n\r\n private toggleCollapse(id: string): void {\r\n $(\"#\"+ id).toggleClass(\"hiddenElement\");\r\n this.positionResponse();\r\n }\r\n\r\n // Wraps an element into a collapsible pane with a title\r\n public makeResizablePane(id: string, paneClass: string, title: string, visibility: (table: Table) => boolean): void {\r\n const pane = $(\"#\" + id);\r\n if (pane.hasClass(\"collapsibleElement\")) {\r\n return;\r\n }\r\n const hidden = pane.hasClass(\"hiddenElement\");\r\n\r\n pane.addClass(\"collapsibleElement\");\r\n const wrap = $(document.createElement(\"div\"));\r\n wrap.addClass(\"collapsibleWrapper\");\r\n if (visibility) {\r\n wrap.attr(\"id\", id + \"Wrapper\");\r\n this.visibilityBindings.push({ name: \"#\" + id + \"Wrapper\", visible: visibility });\r\n }\r\n\r\n // Fix for Bug 1691235 - Create a hidden h2 element for a11y\r\n const hiddenHeading = $(document.createElement(\"h2\"));\r\n hiddenHeading.attr(\"id\", \"button-heading\");\r\n hiddenHeading.addClass(\"header-hidden\");\r\n hiddenHeading.text(title);\r\n\r\n const header = $(document.createElement(\"button\"));\r\n header.addClass(paneClass);\r\n header.on(\"click\", this, function (eventObject) {\r\n const table: Table = eventObject.data as Table;\r\n if (table) {\r\n table.toggleCollapse(id);\r\n header.attr(\"aria-expanded\", header.attr(\"aria-expanded\") === \"true\" ? \"false\" : \"true\");\r\n }\r\n });\r\n header.text(title);\r\n header.attr(\"tabindex\", 0);\r\n header.attr(\"type\", \"button\");\r\n header.attr(\"aria-expanded\", !hidden ? \"true\" : \"false\");\r\n\r\n const switchSpan = $(document.createElement(\"span\"));\r\n switchSpan.attr(\"aria-hidden\", \"true\");\r\n switchSpan.addClass(\"collapsibleSwitch\");\r\n\r\n // Now that everything is built, put it together\r\n pane.wrap(wrap);\r\n pane.before(hiddenHeading);\r\n pane.before(header);\r\n header.append(switchSpan);\r\n }\r\n\r\n private makeVisible(id: string, visible: boolean): void {\r\n if (visible) {\r\n $(id).removeClass(\"hiddenElement\");\r\n } else {\r\n $(id).addClass(\"hiddenElement\");\r\n }\r\n }\r\n\r\n private makeSummaryTable(summaryName: string, rows: Row[], tag: string): void {\r\n const summaryList = $(summaryName);\r\n if (summaryList) {\r\n summaryList.addClass(\"summaryList\");\r\n\r\n rows.forEach((summaryRow: Row) => {\r\n const id = summaryRow.header + tag;\r\n const row = document.createElement(\"tr\");\r\n if (row !== null) {\r\n row.id = id;\r\n summaryList.append(row); // Must happen before we append cells to appease IE7\r\n const headerCell = $(row.insertCell(-1));\r\n if (headerCell) {\r\n if (summaryRow.url) {\r\n headerCell.html(summaryRow.url);\r\n } else {\r\n headerCell.text(summaryRow.label);\r\n }\r\n headerCell.addClass(\"summaryHeader\");\r\n headerCell.attr(\"id\", summaryRow.id);\r\n }\r\n\r\n const valCell = $(row.insertCell(-1));\r\n if (valCell) {\r\n valCell.attr(\"id\", id + \"Val\");\r\n valCell.attr(\"aria-labelledby\", summaryRow.id);\r\n }\r\n\r\n this.makeVisible(\"#\" + id, false);\r\n }\r\n });\r\n }\r\n }\r\n\r\n private setArrows(table: string, colName: string, sortOrder: number): void {\r\n $(\"#\" + table + \" th button\").attr(\"aria-sort\", \"none\");\r\n $(\"#\" + table + \" th #\" + colName).attr(\"aria-sort\", sortOrder === 1 ? \"descending\" : \"ascending\");\r\n }\r\n\r\n private setRowValue(row: Row, type: string): void {\r\n const headerVal = $(\"#\" + row.header + type + \"Val\");\r\n if (headerVal) {\r\n if (row.value) {\r\n if (row.valueUrl) {\r\n headerVal.html(row.valueUrl);\r\n } else {\r\n headerVal.text(row.value);\r\n }\r\n\r\n this.makeVisible(\"#\" + row.header + type, true);\r\n } else {\r\n headerVal.text(\"\");\r\n this.makeVisible(\"#\" + row.header + type, false);\r\n }\r\n }\r\n }\r\n\r\n private appendCell(row: HTMLTableRowElement, text: string | number | null, html: string, cellClass: string): void {\r\n const cell = $(row.insertCell(-1));\r\n if (text) { cell.text(text); }\r\n if (html) { cell.html(html); }\r\n if (cellClass) { cell.addClass(cellClass); }\r\n }\r\n\r\n // Restores table to empty state so we can repopulate it\r\n private emptyTableUI(id: string): void {\r\n $(\"#\" + id + \" tr:not(.tableHeader)\").remove(); // Remove the rows\r\n $(\"#\" + id + \" th\").removeClass(\"emptyColumn\"); // Restore header visibility\r\n $(\"#\" + id + \" th\").removeClass(\"hiddenElement\"); // Restore header visibility\r\n }\r\n\r\n // Recompute visibility with the current viewModel. Does not repopulate.\r\n public recalculateVisibility(): void {\r\n this.visibilityBindings.forEach((binding: Binding) => {\r\n this.makeVisible(binding.name, binding.visible(this));\r\n });\r\n\r\n this.positionResponse();\r\n }\r\n\r\n private hideEmptyColumns(id: string): void {\r\n $(\"#\" + id + \" th\").each(function (i) {\r\n let keep = 0;\r\n\r\n // Find a child cell which has data\r\n const children = $(this).parents(\"table\").find(\"tr td:nth-child(\" + (i + 1).toString() + \")\");\r\n children.each(function () {\r\n if (this.innerHTML !== \"\") {\r\n keep++;\r\n }\r\n });\r\n\r\n if (keep === 0) {\r\n $(this).addClass(\"emptyColumn\");\r\n children.addClass(\"emptyColumn\");\r\n } else {\r\n $(this).removeClass(\"emptyColumn\");\r\n children.removeClass(\"emptyColumn\");\r\n }\r\n });\r\n }\r\n\r\n // Rebuilds content and recalculates what sections should be displayed\r\n // Repopulate the UI with the current viewModel\r\n public rebuildSections(viewModel: HeaderModel): void {\r\n this.viewModel = viewModel;\r\n\r\n // Summary\r\n this.viewModel.summary.rows.forEach((row: Row) => {\r\n this.setRowValue(row, \"SUM\");\r\n });\r\n\r\n // Received\r\n this.emptyTableUI(\"receivedHeaders\");\r\n this.viewModel.receivedHeaders.rows.forEach((receivedRow: ReceivedRow) => {\r\n const row: HTMLTableRowElement = document.createElement(\"tr\");\r\n $(\"#receivedHeaders\").append(row); // Must happen before we append cells to appease IE7\r\n this.appendCell(row, receivedRow.hop.value, \"\", \"\");\r\n this.appendCell(row, receivedRow.from.value, \"\", \"\");\r\n this.appendCell(row, receivedRow.by.value, \"\", \"\");\r\n this.appendCell(row, receivedRow.date.value, \"\", \"\");\r\n let labelClass = \"hotBarLabel\";\r\n if (receivedRow.delaySort.value !== null && typeof receivedRow.delaySort.value === \"number\" && receivedRow.delaySort.value < 0) {\r\n labelClass += \" negativeCell\";\r\n }\r\n\r\n const hotBar =\r\n \"
\" +\r\n \"
\" + receivedRow.delay + \"
\" +\r\n \"
\" +\r\n \"
\";\r\n this.appendCell(row, \"\", hotBar, \"hotBarCell\");\r\n this.appendCell(row, receivedRow.with.value, \"\", \"\");\r\n this.appendCell(row, receivedRow.id.value, \"\", \"extraCol\");\r\n this.appendCell(row, receivedRow.for.value, \"\", \"extraCol\");\r\n this.appendCell(row, receivedRow.via.value, \"\", \"extraCol\");\r\n });\r\n\r\n // Calculate heights for the hotbar cells (progress bars in Delay column)\r\n // Not clear why we need to do this\r\n $(\".hotBarCell\").each(function () {\r\n const height: number | undefined = $(this).height();\r\n if (height) {\r\n $(this).find(\".hotBarContainer\").height(height);\r\n }\r\n });\r\n\r\n $(\"#receivedHeaders tr:odd\").addClass(\"oddRow\");\r\n this.hideEmptyColumns(\"receivedHeaders\");\r\n\r\n // Forefront AntiSpam Report\r\n this.viewModel.forefrontAntiSpamReport.rows.forEach((row: Row) => {\r\n this.setRowValue(row, \"FFAS\");\r\n });\r\n\r\n // AntiSpam Report\r\n this.viewModel.antiSpamReport.rows.forEach((row: Row) => {\r\n this.setRowValue(row, \"AS\");\r\n });\r\n\r\n // Other\r\n this.emptyTableUI(\"otherHeaders\");\r\n this.viewModel.otherHeaders.rows.forEach((otherRow: OtherRow) => {\r\n const row: HTMLTableRowElement = document.createElement(\"tr\");\r\n $(\"#otherHeaders\").append(row); // Must happen before we append cells to appease IE7\r\n this.appendCell(row, otherRow.number.toString(), \"\", \"\");\r\n this.appendCell(row, otherRow.header, otherRow.url, \"\");\r\n this.appendCell(row, otherRow.value, \"\", \"allowBreak\");\r\n });\r\n\r\n $(\"#otherHeaders tr:odd\").addClass(\"oddRow\");\r\n\r\n // Original headers\r\n $(\"#originalHeaders\").text(this.viewModel.originalHeaders);\r\n\r\n this.recalculateVisibility();\r\n }\r\n\r\n private makeSortableColumn(tableName: string, column: Column): JQuery {\r\n const header = $(document.createElement(\"th\"));\r\n if (header !== null) {\r\n const headerButton = $(document.createElement(\"button\"));\r\n if (headerButton !== null) {\r\n headerButton.addClass(\"tableHeaderButton\");\r\n headerButton.attr(\"id\", column.id);\r\n headerButton.attr(\"type\", \"button\");\r\n headerButton.attr(\"role\", \"columnheader\");\r\n headerButton.attr(\"aria-sort\", \"none\");\r\n headerButton.text(column.label);\r\n if (column.class !== null) {\r\n headerButton.addClass(column.class);\r\n }\r\n\r\n headerButton.on(\"click\", this, function (eventObject) {\r\n const table: Table = eventObject.data as Table;\r\n if (table) {\r\n if (table.viewModel[tableName] instanceof ITable) {\r\n const itable = table.viewModel[tableName] as ITable;\r\n itable.doSort(column.id);\r\n table.setArrows(itable.tableName, itable.sortColumn,\r\n itable.sortOrder);\r\n table.rebuildSections(table.viewModel);\r\n }\r\n }\r\n });\r\n\r\n const arrowSpan = $(document.createElement(\"span\"));\r\n arrowSpan.attr(\"aria-hidden\", \"true\");\r\n arrowSpan.addClass(\"sortArrow\");\r\n\r\n // Now that everything is built, put it together\r\n headerButton.append(arrowSpan);\r\n header.append(headerButton);\r\n }\r\n }\r\n\r\n return header;\r\n }\r\n\r\n private addColumns(tableName: string, columns: Column[]): void {\r\n const tableHeader = $(document.createElement(\"thead\"));\r\n if (tableHeader !== null) {\r\n $(\"#\" + tableName).append(tableHeader);\r\n\r\n const headerRow = $(document.createElement(\"tr\"));\r\n if (headerRow !== null) {\r\n headerRow.addClass(\"tableHeader\");\r\n tableHeader.append(headerRow); // Must happen before we append cells to appease IE7\r\n\r\n columns.forEach((column: Column) => {\r\n headerRow.append(this.makeSortableColumn(tableName, column));\r\n });\r\n }\r\n }\r\n }\r\n\r\n private hideExtraColumns(): void {\r\n this.showExtra = false;\r\n $(\"#leftArrow\").addClass(\"hiddenElement\");\r\n $(\"#rightArrow\").removeClass(\"hiddenElement\");\r\n }\r\n\r\n private showExtraColumns(): void {\r\n this.showExtra = true;\r\n $(\"#rightArrow\").addClass(\"hiddenElement\");\r\n $(\"#leftArrow\").removeClass(\"hiddenElement\");\r\n }\r\n\r\n private toggleExtraColumns(): void {\r\n if (this.showExtra) {\r\n this.hideExtraColumns();\r\n } else {\r\n this.showExtraColumns();\r\n }\r\n\r\n this.recalculateVisibility();\r\n }\r\n\r\n public resetArrows(): void {\r\n this.setArrows(\"receivedHeaders\", \"hop\", 1);\r\n this.setArrows(\"otherHeaders\", \"number\", 1);\r\n }\r\n\r\n // Initialize UI with an empty viewModel\r\n public initializeTableUI(viewModel: HeaderModel): void {\r\n this.viewModel = viewModel;\r\n\r\n // Headers\r\n this.makeResizablePane(\"originalHeaders\", \"sectionHeader\", mhaStrings.mhaOriginalHeaders, (table: Table) => { return table.viewModel.originalHeaders.length > 0; });\r\n this.toggleCollapse(\"originalHeaders\"); // start this section hidden\r\n\r\n // Summary\r\n this.makeResizablePane(\"summary\", \"sectionHeader\", mhaStrings.mhaSummary, function (table: Table) { return table.viewModel.summary.exists(); });\r\n this.makeSummaryTable(\"#summary\", this.viewModel.summary.rows, \"SUM\");\r\n\r\n // Received\r\n this.makeResizablePane(\"receivedHeaders\", \"tableCaption\", mhaStrings.mhaReceivedHeaders, function (table: Table) { return table.viewModel.receivedHeaders.exists(); });\r\n\r\n const receivedColumns = [\r\n new Column(\"hop\", mhaStrings.mhaReceivedHop, \"\"),\r\n new Column(\"from\", mhaStrings.mhaReceivedSubmittingHost, \"\"),\r\n new Column(\"by\", mhaStrings.mhaReceivedReceivingHost, \"\"),\r\n new Column(\"date\", mhaStrings.mhaReceivedTime, \"\"),\r\n new Column(\"delay\", mhaStrings.mhaReceivedDelay, \"\"),\r\n new Column(\"with\", mhaStrings.mhaReceivedType, \"\"),\r\n new Column(\"id\", mhaStrings.mhaReceivedId, \"extraCol\"),\r\n new Column(\"for\", mhaStrings.mhaReceivedFor, \"extraCol\"),\r\n new Column(\"via\", mhaStrings.mhaReceivedVia, \"extraCol\")\r\n ];\r\n\r\n this.addColumns(this.viewModel.receivedHeaders.tableName, receivedColumns);\r\n\r\n const withColumn = $(\"#receivedHeaders #with\");\r\n if (withColumn !== null) {\r\n const leftSpan = $(document.createElement(\"span\"));\r\n leftSpan.attr(\"id\", \"leftArrow\");\r\n leftSpan.addClass(\"collapsibleArrow\");\r\n leftSpan.addClass(\"hiddenElement\");\r\n leftSpan.html(\"⇐\");\r\n\r\n const rightSpan = $(document.createElement(\"span\"));\r\n rightSpan.attr(\"id\", \"rightArrow\");\r\n rightSpan.addClass(\"collapsibleArrow\");\r\n rightSpan.html(\"⇒\");\r\n\r\n withColumn.append(leftSpan);\r\n withColumn.append(rightSpan);\r\n }\r\n\r\n $(\"#receivedHeaders .collapsibleArrow\").on(\"click\", this, function (eventObject) {\r\n const table: Table = eventObject.data as Table;\r\n if (table) {\r\n table.toggleExtraColumns();\r\n eventObject.stopPropagation();\r\n }\r\n });\r\n\r\n // FFAS\r\n this.makeResizablePane(\"forefrontAntiSpamReport\", \"sectionHeader\", mhaStrings.mhaForefrontAntiSpamReport, function (table: Table) { return table.viewModel.forefrontAntiSpamReport.exists(); });\r\n this.makeSummaryTable(\"#forefrontAntiSpamReport\", this.viewModel.forefrontAntiSpamReport.rows, \"FFAS\");\r\n\r\n // AntiSpam\r\n this.makeResizablePane(\"antiSpamReport\", \"sectionHeader\", mhaStrings.mhaAntiSpamReport, (table: Table) => { return table.viewModel.antiSpamReport.exists(); });\r\n this.makeSummaryTable(\"#antiSpamReport\", this.viewModel.antiSpamReport.rows, \"AS\");\r\n\r\n // Other\r\n this.makeResizablePane(\"otherHeaders\", \"tableCaption\", mhaStrings.mhaOtherHeaders, function (table: Table) { return table.viewModel.otherHeaders.rows.length > 0; });\r\n\r\n const otherColumns = [\r\n new Column(\"number\", mhaStrings.mhaNumber, \"\"),\r\n new Column(\"header\", mhaStrings.mhaHeader, \"\"),\r\n new Column(\"value\", mhaStrings.mhaValue, \"\")\r\n ];\r\n\r\n this.addColumns(this.viewModel.otherHeaders.tableName, otherColumns);\r\n\r\n this.resetArrows();\r\n this.rebuildSections(this.viewModel);\r\n }\r\n\r\n // Rebuilds the UI with a new viewModel\r\n // Used by mha.ts and Default.ts to rebuild with new viewModel\r\n public rebuildTables(viewModel: HeaderModel): void {\r\n this.viewModel = viewModel;\r\n this.rebuildSections(this.viewModel);\r\n this.hideExtraColumns();\r\n }\r\n}\r\n"],"names":["Column","constructor","id","label","columnClass","this","class","Table","viewModel","showExtra","visibilityBindings","name","visible","table","hasData","status","positionResponse","lineBreak","responseTop","offsetTop","height","css","toggleCollapse","toggleClass","makeResizablePane","paneClass","title","visibility","pane","hasClass","hidden","addClass","wrap","document","createElement","attr","push","hiddenHeading","text","header","on","eventObject","data","switchSpan","before","append","makeVisible","removeClass","makeSummaryTable","summaryName","rows","tag","summaryList","forEach","summaryRow","row","headerCell","insertCell","url","html","valCell","setArrows","colName","sortOrder","setRowValue","type","headerVal","value","valueUrl","appendCell","cellClass","cell","emptyTableUI","remove","recalculateVisibility","binding","hideEmptyColumns","each","i","keep","children","parents","find","toString","innerHTML","rebuildSections","summary","receivedHeaders","receivedRow","hop","from","by","date","labelClass","delaySort","hotBar","delay","percent","with","for","via","forefrontAntiSpamReport","antiSpamReport","otherHeaders","otherRow","number","originalHeaders","makeSortableColumn","tableName","column","headerButton","ITable","itable","doSort","sortColumn","arrowSpan","addColumns","columns","tableHeader","headerRow","hideExtraColumns","showExtraColumns","toggleExtraColumns","resetArrows","initializeTableUI","mhaStrings","mhaOriginalHeaders","length","mhaSummary","exists","mhaReceivedHeaders","receivedColumns","mhaReceivedHop","mhaReceivedSubmittingHost","mhaReceivedReceivingHost","mhaReceivedTime","mhaReceivedDelay","mhaReceivedType","mhaReceivedId","mhaReceivedFor","mhaReceivedVia","withColumn","leftSpan","rightSpan","stopPropagation","mhaForefrontAntiSpamReport","mhaAntiSpamReport","mhaOtherHeaders","otherColumns","mhaNumber","mhaHeader","mhaValue","rebuildTables"],"sourceRoot":""}