diff --git a/dist/subtotal.js b/dist/subtotal.js index e9568c5..3983b2a 100644 --- a/dist/subtotal.js +++ b/dist/subtotal.js @@ -1112,10 +1112,10 @@ $.pivotUtilities.subtotalAggregatorTemplates = subtotalAggregatorTemplates; return $.pivotUtilities.subtotal_aggregators = (function(tpl, sTpl) { return { - "Count As Fraction Of Parent Row": sTpl.fractionOf(tpl.count(), "row", usFmtPct), - "Count As Fraction Of Parent Column": sTpl.fractionOf(tpl.count(), "col", usFmtPct), "Sum As Fraction Of Parent Row": sTpl.fractionOf(tpl.sum(), "row", usFmtPct), - "Sum As Fraction Of Parent Column": sTpl.fractionOf(tpl.sum(), "col", usFmtPct) + "Sum As Fraction Of Parent Column": sTpl.fractionOf(tpl.sum(), "col", usFmtPct), + "Count As Fraction Of Parent Row": sTpl.fractionOf(tpl.count(), "row", usFmtPct), + "Count As Fraction Of Parent Column": sTpl.fractionOf(tpl.count(), "col", usFmtPct) }; })(aggregatorTemplates, subtotalAggregatorTemplates); }); diff --git a/dist/subtotal.js.map b/dist/subtotal.js.map index 488f5e9..fa031da 100644 --- a/dist/subtotal.js.map +++ b/dist/subtotal.js.map @@ -1 +1 @@ -{"version":3,"file":"subtotal.js","sources":["subtotal.coffee"],"names":[],"mappings":"AAAA;AAAA,MAAA,cAAA;IAAA;;;;EAAA,cAAA,GAAiB,SAAC,WAAD;IACb,IAAG,OAAO,OAAP,KAAkB,QAAlB,IAA+B,OAAO,MAAP,KAAiB,QAAnD;aACI,WAAA,CAAY,OAAA,CAAQ,QAAR,CAAZ,EADJ;KAAA,MAEK,IAAG,OAAO,MAAP,KAAiB,UAAjB,IAAgC,MAAM,CAAC,GAA1C;aACD,MAAA,CAAO,CAAC,QAAD,CAAP,EAAmB,WAAnB,EADC;KAAA,MAAA;aAID,WAAA,CAAY,MAAZ,EAJC;;EAHQ;;EASjB,cAAA,CAAe,SAAC,CAAD;AAEX,QAAA;IAAM;AACF,UAAA;;;;MAAa,2BAAC,KAAD,EAAQ,IAAR;Q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,oCAAA,EAAwC,IAAI,CAAC,UAAL,CAAgB,GAAG,CAAC,KAAJ,CAAA,CAAhB,EAA6B,KAA7B,EAAoC,QAApC,CADxC;QAEA,+BAAA,EAAwC,IAAI,CAAC,UAAL,CAAgB,GAAG,CAAC,GAAJ,CAAA,CAAhB,EAA2B,KAA3B,EAAkC,QAAlC,CAFxC;QAGA,kCAAA,EAAwC,IAAI,CAAC,UAAL,CAAgB,GAAG,CAAC,GAAJ,CAAA,CAAhB,EAA2B,KAA3B,EAAkC,QAAlC,CAHxC;;IADuC,CAAA,CAAH,CAAU,mBAAV,EAAsC,2BAAtC;EAtuB7B,CAAf;AATA","sourcesContent":["callWithJQuery = (pivotModule) ->\r\n if typeof exports is \"object\" and typeof module is \"object\" # CommonJS\r\n pivotModule require(\"jquery\")\r\n else if typeof define is \"function\" and define.amd # AMD\r\n define [\"jquery\"], pivotModule\r\n # Plain browser env\r\n else\r\n pivotModule jQuery\r\n\r\ncallWithJQuery ($) ->\r\n\r\n class SubtotalPivotData extends $.pivotUtilities.PivotData\r\n constructor: (input, opts) ->\r\n super input, opts\r\n\r\n processKey = (record, totals, keys, attrs, getAggregator) ->\r\n key = []\r\n addKey = false\r\n for attr in attrs\r\n key.push record[attr] ? \"null\"\r\n flatKey = key.join String.fromCharCode(0)\r\n if not totals[flatKey]\r\n totals[flatKey] = getAggregator key.slice()\r\n addKey = true\r\n totals[flatKey].push record\r\n keys.push key if addKey\r\n return key\r\n\r\n processRecord: (record) -> #this code is called in a tight loop\r\n rowKey = []\r\n colKey = []\r\n\r\n @allTotal.push record\r\n rowKey = processKey record, @rowTotals, @rowKeys, @rowAttrs, (key) =>\r\n return @aggregator this, key, []\r\n colKey = processKey record, @colTotals, @colKeys, @colAttrs, (key) =>\r\n return @aggregator this, [], key\r\n m = rowKey.length-1\r\n n = colKey.length-1\r\n return if m < 0 or n < 0\r\n for i in [0..m]\r\n fRowKey = rowKey.slice(0, i+1)\r\n flatRowKey = fRowKey.join String.fromCharCode(0)\r\n @tree[flatRowKey] = {} if not @tree[flatRowKey]\r\n for j in [0..n]\r\n fColKey = colKey.slice 0, j+1\r\n flatColKey = fColKey.join String.fromCharCode(0)\r\n @tree[flatRowKey][flatColKey] = @aggregator this, fRowKey, fColKey if not @tree[flatRowKey][flatColKey]\r\n @tree[flatRowKey][flatColKey].push record\r\n\r\n $.pivotUtilities.SubtotalPivotData = SubtotalPivotData\r\n\r\n SubtotalRenderer = (pivotData, opts) ->\r\n defaults =\r\n table: clickCallback: null\r\n localeStrings: totals: \"Totals\"\r\n\r\n opts = $.extend true, {}, defaults, opts\r\n\r\n arrowCollapsed = opts.arrowCollapsed ?= \"\\u25B6\"\r\n arrowExpanded = opts.arrowExpanded ?= \"\\u25E2\"\r\n classExpanded = \"expanded\"\r\n classCollapsed = \"collapsed\"\r\n colAttrs = pivotData.colAttrs\r\n rowAttrs = pivotData.rowAttrs\r\n rowKeys = pivotData.getRowKeys()\r\n colKeys = pivotData.getColKeys()\r\n tree = pivotData.tree\r\n rowTotals = pivotData.rowTotals\r\n colTotals = pivotData.colTotals\r\n allTotal = pivotData.allTotal\r\n\r\n # Based on http://stackoverflow.com/questions/195951/change-an-elements-class-with-javascript -- Begin\r\n hasClass = (element, className) ->\r\n regExp = new RegExp \"(?:^|\\\\s)\" + className + \"(?!\\\\S)\", \"g\"\r\n element.className.match regExp\r\n\r\n removeClass = (element, className) ->\r\n regExp = new RegExp \"(?:^|\\\\s)\" + className + \"(?!\\\\S)\", \"g\"\r\n element.className = element.className.replace regExp, ''\r\n\r\n addClass = (element, className) ->\r\n element.className += (\" \" + className) if not hasClass element, className\r\n\r\n replaceClass = (element, replaceClassName, byClassName) ->\r\n removeClass element, replaceClassName\r\n addClass element, byClassName\r\n # Based on http://stackoverflow.com/questions/195951/change-an-elements-class-with-javascript -- End\r\n\r\n getTableEventHandlers = (value, rowValues, colValues) ->\r\n return if not opts.table and not opts.table.eventHandlers\r\n eventHandlers = {}\r\n for own event, handler of opts.table.eventHandlers\r\n filters = {}\r\n filters[attr] = colValues[i] for own i, attr of colAttrs when colValues[i]?\r\n filters[attr] = rowValues[i] for own i, attr of rowAttrs when rowValues[i]?\r\n eventHandlers[event] = (e) -> handler(e, value, filters, pivotData)\r\n return eventHandlers\r\n\r\n createCell = (cellType, className, textContent, attributes, eventHandlers) ->\r\n th = document.createElement cellType\r\n th.className = className if className?\r\n th.textContent = textContent if textContent?\r\n th.setAttribute attr, val for own attr, val of attributes if attributes?\r\n th.addEventListener event, handler for own event, handler of eventHandlers if eventHandlers?\r\n return th\r\n\r\n processKeys = (keysArr, className) ->\r\n headers = []\r\n lastRow = keysArr.length - 1\r\n lastCol = keysArr[0].length - 1\r\n rMark = []\r\n th = createCell \"th\", className, keysArr[0][0]\r\n key = []\r\n key.push keysArr[0][0]\r\n nodePos = 0\r\n node = {\r\n node: nodePos,\r\n row: 0,\r\n col: 0,\r\n th: th,\r\n parent: null,\r\n children: [],\r\n descendants: lastCol,\r\n leaves: 1,\r\n key: key,\r\n flatKey: key.join String.fromCharCode(0)}\r\n headers.push node\r\n rMark[0] = node\r\n c = 1\r\n while c <= lastCol\r\n th = createCell \"th\", className, keysArr[0][c]\r\n key = key.slice()\r\n key.push keysArr[0][c]\r\n ++nodePos\r\n node = {\r\n node: nodePos,\r\n row: 0,\r\n col: c,\r\n th: th,\r\n parent: rMark[c-1],\r\n children: [],\r\n descendants: lastCol-c,\r\n leaves: 1,\r\n key: key,\r\n flatKey: key.join String.fromCharCode(0)}\r\n rMark[c] = node\r\n rMark[c-1].children.push node\r\n ++c\r\n rMark[lastCol].leaves = 0\r\n r = 1\r\n while r <= lastRow\r\n repeats = true\r\n key = []\r\n c = 0\r\n while c <= lastCol\r\n key = key.slice()\r\n key.push keysArr[r][c]\r\n if ((keysArr[r][c] is keysArr[rMark[c].row][c]) and (c isnt lastCol) and (repeats))\r\n repeats = true\r\n ++c\r\n continue\r\n th = createCell \"th\", className, keysArr[r][c]\r\n ++nodePos\r\n node = {\r\n node: nodePos,\r\n row: r,\r\n col: c,\r\n th: th,\r\n parent: null,\r\n children: [],\r\n descendants: 0,\r\n leaves: 1,\r\n key: key,\r\n flatKey: key.join String.fromCharCode(0)}\r\n if c is 0\r\n headers.push node\r\n else\r\n node.parent = rMark[c-1]\r\n rMark[c-1].children.push node\r\n x = 0\r\n while x <= c-1\r\n ++rMark[x].descendants\r\n ++x\r\n rMark[c] = node\r\n repeats = false\r\n ++c\r\n ++rMark[c].leaves for c in [0..lastCol]\r\n rMark[lastCol].leaves = 0\r\n ++r\r\n return headers\r\n\r\n buildColHeaderHeader = (thead, colHeaderHeaders, rowAttrs, colAttrs, tr, col) ->\r\n colAttr = colAttrs[col]\r\n textContent = colAttr\r\n className = \"pvtAxisLabel\"\r\n if col < colAttrs.length-1\r\n className += \" expanded\"\r\n textContent = \" \" + arrowExpanded + \" \" + colAttr\r\n th = createCell \"th\", className, textContent\r\n th.setAttribute \"data-colAttr\", colAttr\r\n tr.appendChild th\r\n colHeaderHeaders.push {\r\n tr: tr,\r\n th: th,\r\n clickStatus: classExpanded,\r\n expandedCount: 0,\r\n nHeaders: 0}\r\n thead.appendChild tr\r\n\r\n buildColHeaderHeaders = (thead, colHeaderHeaders, rowAttrs, colAttrs) ->\r\n tr = document.createElement \"tr\"\r\n if rowAttrs.length != 0\r\n tr.appendChild createCell \"th\", null, null, {\r\n colspan: rowAttrs.length,\r\n rowspan: colAttrs.length}\r\n buildColHeaderHeader thead, colHeaderHeaders, rowAttrs, colAttrs, tr, 0\r\n for c in [1..colAttrs.length] when c < colAttrs.length\r\n tr = document.createElement(\"tr\")\r\n buildColHeaderHeader thead, colHeaderHeaders, rowAttrs, colAttrs, tr, c\r\n\r\n buildColHeaderHeadersClickEvents = (colHeaderHeaders, colHeaderCols, colAttrs) ->\r\n n = colAttrs.length-1\r\n for i in [0..n] when i < n\r\n th = colHeaderHeaders[i].th\r\n colAttr = colAttrs[i]\r\n th.onclick = (event) ->\r\n event = event || window.event\r\n toggleColHeaderHeader colHeaderHeaders, colHeaderCols, colAttrs, event.target.getAttribute \"data-colAttr\"\r\n\r\n buildColHeaders = (colHeaderHeaders, colHeaderCols, colHeader, rowAttrs, colAttrs) ->\r\n # DF Recurse\r\n for h in colHeader.children\r\n buildColHeaders colHeaderHeaders, colHeaderCols, h, rowAttrs, colAttrs\r\n # Process\r\n hh = colHeaderHeaders[colHeader.col]\r\n ++hh.expandedCount\r\n ++hh.nHeaders\r\n tr = hh.tr\r\n th = colHeader.th\r\n th.setAttribute \"data-colHeader\", th.textContent\r\n th.setAttribute(\"rowspan\", 2) if colHeader.col == colAttrs.length-1 and rowAttrs.length != 0\r\n th.setAttribute(\"colspan\", colHeader.descendants+1) if colHeader.children.length !=0\r\n th.setAttribute(\"data-node\", colHeaderCols.length)\r\n tr.appendChild(th)\r\n if colHeader.children.length != 0\r\n addClass th, classExpanded\r\n th.textContent = \" \" + arrowExpanded + \" \" + th.textContent\r\n th.onclick = (event) ->\r\n event = event || window.event\r\n toggleCol colHeaderHeaders, colHeaderCols, parseInt event.target.getAttribute \"data-node\"\r\n rowspan = colAttrs.length-(colHeader.col+1) + if rowAttrs.length != 0 then 1 else 0\r\n style = \"pvtColLabel pvtColSubtotal col\" + colHeader.row\r\n th = createCell \"th\", style, '', {\"rowspan\": rowspan}\r\n colHeader.children[0].tr.appendChild th\r\n colHeader.sTh = th\r\n colHeader.clickStatus = classExpanded\r\n colHeader.tr = tr\r\n colHeaderCols.push colHeader\r\n\r\n buildRowHeaderHeaders = (thead, rowHeaderHeaders, rowAttrs, colAttrs) ->\r\n tr = document.createElement \"tr\"\r\n rowHeaderHeaders.hh = []\r\n for own i, rowAttr of rowAttrs\r\n textContent = rowAttr\r\n className = \"pvtAxisLabel\"\r\n if i < rowAttrs.length-1\r\n className += \" expanded\"\r\n textContent = \" \" + arrowExpanded + \" \" + rowAttr\r\n th = createCell \"th\", className, textContent\r\n th.setAttribute \"data-rowAttr\", rowAttr\r\n tr.appendChild th\r\n rowHeaderHeaders.hh.push {\r\n th: th,\r\n clickStatus: classExpanded,\r\n expandedCount: 0,\r\n nHeaders: 0}\r\n if colAttrs.length != 0\r\n th = createCell \"th\"\r\n tr.appendChild th\r\n thead.appendChild tr\r\n rowHeaderHeaders.tr = tr\r\n\r\n buildRowHeaderHeadersClickEvents = (rowHeaderHeaders, rowHeaderRows, rowAttrs) ->\r\n n = rowAttrs.length-1\r\n for i in [0..n] when i < n\r\n th = rowHeaderHeaders.hh[i]\r\n rowAttr = rowAttrs[i]\r\n th.th.onclick = (event) ->\r\n event = event || window.event\r\n toggleRowHeaderHeader rowHeaderHeaders, rowHeaderRows, rowAttrs, event.target.getAttribute \"data-rowAttr\"\r\n\r\n buildRowTotalsHeader = (tr, rowAttrs, colAttrs) ->\r\n rowspan = 1\r\n if colAttrs.length != 0\r\n rowspan = colAttrs.length + (if rowAttrs.length == 0 then 0 else 1)\r\n th = createCell \"th\", \"pvtTotalLabel rowTotal\", opts.localeStrings.totals, {rowspan: rowspan}\r\n tr.appendChild th\r\n\r\n buildRowHeaders = (tbody, rowHeaderHeaders, rowHeaderRows, rowHeader, rowAttrs, colAttrs) ->\r\n hh = rowHeaderHeaders.hh[rowHeader.col]\r\n ++hh.expandedCount\r\n ++hh.nHeaders\r\n tr = document.createElement \"tr\"\r\n th = rowHeader.th\r\n th.setAttribute \"rowspan\", rowHeader.descendants+1\r\n th.setAttribute \"data-rowHeader\", th.textContent\r\n if rowHeader.col == rowAttrs.length-1 and colAttrs.length != 0\r\n th.setAttribute \"colspan\", 2\r\n th.setAttribute \"data-node\", rowHeaderRows.length\r\n tr.appendChild th\r\n if rowHeader.children.length != 0\r\n addClass th, classExpanded\r\n th.textContent = \" \" + arrowExpanded + \" \" + th.textContent\r\n th.onclick = (event) ->\r\n event = event || window.event\r\n toggleRow rowHeaderHeaders, rowHeaderRows, parseInt event.target.getAttribute \"data-node\"\r\n colspan = rowAttrs.length-(rowHeader.col+1) + if colAttrs.length != 0 then 1 else 0\r\n th = createCell \"th\", \"pvtRowLabel pvtRowSubtotal\", '', {colspan: colspan}\r\n tr.appendChild th\r\n rowHeader.clickStatus = classExpanded\r\n rowHeader.tr = tr\r\n rowHeaderRows.push rowHeader\r\n tbody.appendChild tr\r\n for h in rowHeader.children\r\n buildRowHeaders tbody, rowHeaderHeaders, rowHeaderRows, h, rowAttrs, colAttrs\r\n\r\n buildValues = (rowHeaderRows, colHeaderCols) ->\r\n for rowHeader in rowHeaderRows\r\n tr = rowHeader.tr\r\n flatRowKey = rowHeader.flatKey\r\n for colHeader in colHeaderCols\r\n flatColKey = colHeader.flatKey\r\n aggregator = tree[flatRowKey][flatColKey] ? {value: (-> null), format: -> \"\"}\r\n val = aggregator.value()\r\n style = \"pvtVal\"\r\n style += \" pvtColSubtotal\" if colHeader.children.length != 0\r\n style += \" pvtRowSubtotal\" if rowHeader.children.length != 0\r\n style += \" row\" + rowHeader.row +\r\n \" col\" + colHeader.row +\r\n \" rowcol\" + rowHeader.col +\r\n \" colcol\" + colHeader.col\r\n eventHandlers = getTableEventHandlers val, rowHeader.key, colHeader.key\r\n td = createCell \"td\", style, aggregator.format(val), {\"data-value\": val}, eventHandlers\r\n tr.appendChild td\r\n # buildRowTotal\r\n totalAggregator = rowTotals[flatRowKey]\r\n val = totalAggregator.value()\r\n style = \"pvtTotal rowTotal\"\r\n style += \" pvtRowSubtotal\" if rowHeader.children.length != 0\r\n style += \" row\" + rowHeader.row + \" rowcol\" + rowHeader.col\r\n td = createCell \"td\", style, totalAggregator.format(val), {\r\n \"data-value\": val,\r\n \"data-row\": \"row\"+rowHeader.row,\r\n \"data-col\": \"col\"+rowHeader.col}, getTableEventHandlers val, rowHeader.key, []\r\n tr.appendChild td\r\n\r\n buildColTotalsHeader = (rowAttrs, colAttrs) ->\r\n tr = document.createElement \"tr\"\r\n colspan = rowAttrs.length + (if colAttrs.length == 0 then 0 else 1)\r\n th = createCell \"th\", \"pvtTotalLabel colTotal\", opts.localeStrings.totals, {colspan: colspan}\r\n tr.appendChild th\r\n return tr\r\n\r\n buildColTotals = (tr, colHeaderCols) ->\r\n for h in colHeaderCols\r\n totalAggregator = colTotals[h.flatKey]\r\n val = totalAggregator.value()\r\n style = \"pvtVal pvtTotal colTotal\"\r\n style += \" pvtColSubtotal\" if h.children.length != 0\r\n style += \" col\" + h.row + \" colcol\" + h.col\r\n td = createCell \"td\", style, totalAggregator.format(val),\r\n {\"data-value\": val, \"data-for\": \"col\" + h.col},\r\n getTableEventHandlers val, [], h.key\r\n tr.appendChild td\r\n\r\n buildGrandTotal = (result, tr) ->\r\n totalAggregator = allTotal\r\n val = totalAggregator.value()\r\n td = createCell \"td\", \"pvtGrandTotal\", totalAggregator.format(val),\r\n {\"data-value\": val},\r\n getTableEventHandlers val, [], []\r\n tr.appendChild td\r\n result.appendChild tr\r\n\r\n setColVisibility = (visibility, h) ->\r\n h.th.style.display = visibility\r\n if h.children.length != 0\r\n $(h.th).closest 'table.pvtTable'\r\n .find 'tbody tr td.pvtColSubtotal.col' + h.row + '.colcol' + h.col\r\n .css 'display', visibility\r\n else\r\n $(h.th)\r\n .closest 'table.pvtTable'\r\n .find 'tbody tr td.pvtVal.col' + h.row\r\n .not '.pvtColSubtotal'\r\n .css 'display', visibility\r\n h.sTh.style.display = visibility if h.sTh\r\n\r\n collapseCol = (colHeaderHeaders, colHeaderCols, c) ->\r\n return if not colHeaderCols[c]\r\n\r\n h = colHeaderCols[c]\r\n return if h.clickStatus is classCollapsed\r\n\r\n colspan = 0\r\n for i in [1..h.descendants] when h.descendants != 0\r\n d = colHeaderCols[c-i]\r\n if d.th.style.display isnt \"none\"\r\n ++colspan\r\n setColVisibility \"none\", d\r\n p = h.parent\r\n while p isnt null\r\n p.th.setAttribute(\"colspan\", parseInt(p.th.getAttribute(\"colspan\")) - colspan)\r\n p = p.parent\r\n if h.descendants != 0\r\n replaceClass h.th, classExpanded, classCollapsed\r\n h.th.textContent = \" \" + arrowCollapsed + \" \" + h.th.getAttribute \"data-colHeader\"\r\n h.clickStatus = classCollapsed\r\n h.th.setAttribute \"colspan\", 1\r\n h.th.style.display = \"\"\r\n colHeaderHeader = colHeaderHeaders[h.col]\r\n colHeaderHeader.expandedCount--\r\n if colHeaderHeader.expandedCount == 0\r\n for i in [h.col..colHeaderHeaders.length-2]\r\n colHeaderHeader = colHeaderHeaders[i]\r\n replaceClass colHeaderHeader.th, classExpanded, classCollapsed\r\n colHeaderHeader.th.textContent = \" \" + arrowCollapsed + \" \" + colHeaderHeader.th.getAttribute \"data-colAttr\"\r\n colHeaderHeader.clickStatus = classCollapsed\r\n\r\n expandChildCol = (ch) ->\r\n setColVisibility \"\", ch if ch.th.style.display is \"none\"\r\n expandChildCol gch for gch in ch.children if ch.clickStatus isnt classCollapsed\r\n\r\n expandCol = (colHeaderHeaders, colHeaderCols, c) ->\r\n return if not colHeaderCols[c]\r\n\r\n h = colHeaderCols[c]\r\n return if h.clickStatus is classExpanded\r\n\r\n colspan = 0\r\n for ch in h.children\r\n colspan += ch.th.colSpan\r\n setColVisibility \"\", ch if ch.th.style.display is \"none\"\r\n expandChildCol ch\r\n if h.descendants != 0\r\n replaceClass h.th, classCollapsed, classExpanded\r\n h.th.textContent = \" \" + arrowExpanded + \" \" + h.th.getAttribute \"data-colHeader\"\r\n h.th.setAttribute \"colspan\", colspan+1\r\n h.clickStatus = classExpanded\r\n h.th.style.display = \"\"\r\n h.sTh.style.display = \"\" if h.sTh?\r\n p = h.parent\r\n while p isnt null\r\n p.th.setAttribute \"colspan\", colspan + parseInt p.th.getAttribute \"colspan\"\r\n p = p.parent\r\n hh = colHeaderHeaders[h.col]\r\n ++hh.expandedCount\r\n if hh.expandedCount is hh.nHeaders\r\n replaceClass hh.th, classCollapsed, classExpanded\r\n hh.th.textContent = \" \" + arrowExpanded + \" \" + hh.th.getAttribute \"data-colAttr\"\r\n hh.clickStatus = classExpanded\r\n\r\n collapseRow = (rowHeaderHeaders, rowHeaderRows, r) ->\r\n return if not rowHeaderRows[r]\r\n\r\n h = rowHeaderRows[r]\r\n return if h.clickStatus is classCollapsed\r\n\r\n rowspan = 0\r\n for i in [1..h.descendants] when h.descendants != 0\r\n d = rowHeaderRows[r+i]\r\n if d.tr.style.display isnt \"none\"\r\n ++rowspan\r\n d.tr.style.display = \"none\"\r\n p = h.parent\r\n while p isnt null\r\n p.th.setAttribute \"rowspan\", parseInt p.th.getAttribute(\"rowspan\")-rowspan\r\n p = p.parent\r\n if h.descendants != 0\r\n replaceClass h.th, classExpanded, classCollapsed\r\n h.th.textContent = \" \" + arrowCollapsed + \" \" + h.th.getAttribute \"data-rowHeader\"\r\n h.clickStatus = classCollapsed\r\n h.th.setAttribute \"rowspan\", 1\r\n h.tr.style.display = \"\"\r\n rowHeaderHeader = rowHeaderHeaders.hh[h.col]\r\n rowHeaderHeader.expandedCount--\r\n return if rowHeaderHeader.expandedCount != 0\r\n for j in [h.col..rowHeaderHeaders.hh.length-2]\r\n rowHeaderHeader = rowHeaderHeaders.hh[j]\r\n replaceClass rowHeaderHeader.th, classExpanded, classCollapsed\r\n rowHeaderHeader.th.textContent =\r\n \" \" + arrowCollapsed + \" \" + rowHeaderHeader.th.getAttribute \"data-rowAttr\"\r\n rowHeaderHeader.clickStatus = classCollapsed\r\n\r\n expandChildRow = (ch) ->\r\n ch.tr.style.display = \"\" if ch.tr.style.display is \"none\"\r\n expandChildRow gch for gch in ch.children if ch.clickStatus isnt classCollapsed\r\n\r\n expandRow = (rowHeaderHeaders, rowHeaderRows, r) ->\r\n return if not rowHeaderRows[r]\r\n\r\n h = rowHeaderRows[r]\r\n return if h.clickStatus is classExpanded\r\n\r\n rowspan = 0\r\n for ch in h.children\r\n rowspan += ch.th.rowSpan\r\n ch.tr.style.display = \"\" if ch.tr.style.display is \"none\"\r\n expandChildRow ch\r\n if h.descendants != 0\r\n replaceClass h.th, classCollapsed, classExpanded\r\n h.th.textContent = \" \" + arrowExpanded + \" \" + h.th.getAttribute \"data-rowHeader\"\r\n h.th.setAttribute \"rowspan\", rowspan+1\r\n h.clickStatus = classExpanded\r\n h.tr.style.display = \"\"\r\n p = h.parent\r\n while p isnt null\r\n p.th.setAttribute \"rowspan\", rowspan + parseInt p.th.getAttribute \"rowspan\"\r\n p = p.parent\r\n hh = rowHeaderHeaders.hh[h.col]\r\n ++hh.expandedCount\r\n if hh.expandedCount == hh.nHeaders\r\n replaceClass hh.th, classCollapsed, classExpanded\r\n hh.th.textContent = \" \" + arrowExpanded + \" \" + hh.th.getAttribute \"data-rowAttr\"\r\n hh.clickStatus = classExpanded\r\n\r\n toggleCol = (colHeaderHeaders, colHeaderCols, c) ->\r\n return if not colHeaderCols[c]?\r\n\r\n h = colHeaderCols[c]\r\n if h.clickStatus is classCollapsed\r\n expandCol(colHeaderHeaders, colHeaderCols, c)\r\n else\r\n collapseCol(colHeaderHeaders, colHeaderCols, c)\r\n h.th.scrollIntoView\r\n\r\n toggleRow = (rowHeaderHeaders, rowHeaderRows, r) ->\r\n return if not rowHeaderRows[r]?\r\n\r\n if rowHeaderRows[r].clickStatus is classCollapsed\r\n expandRow(rowHeaderHeaders, rowHeaderRows, r)\r\n else\r\n collapseRow(rowHeaderHeaders, rowHeaderRows, r)\r\n\r\n collapseColsAt = (colHeaderHeaders, colHeaderCols, colAttrs, colAttr) ->\r\n if typeof colAttr is 'string'\r\n idx = colAttrs.indexOf colAttr\r\n else\r\n idx = colAttr\r\n return if idx < 0 or idx == colAttrs.length-1\r\n i = idx\r\n nAttrs = colAttrs.length-1\r\n while i < nAttrs\r\n hh = colHeaderHeaders[i]\r\n replaceClass hh.th, classExpanded, classCollapsed\r\n hh.th.textContent = \" \" + arrowCollapsed + \" \" + colAttrs[i]\r\n hh.clickStatus = classCollapsed\r\n ++i\r\n i = 0\r\n nCols = colHeaderCols.length\r\n while i < nCols\r\n h = colHeaderCols[i]\r\n if h.col is idx and h.clickStatus isnt classCollapsed and h.th.style.display isnt \"none\"\r\n collapseCol colHeaderHeaders, colHeaderCols, parseInt h.th.getAttribute(\"data-node\")\r\n ++i\r\n\r\n expandColsAt = (colHeaderHeaders, colHeaderCols, colAttrs, colAttr) ->\r\n if typeof colAttr is 'string'\r\n idx = colAttrs.indexOf colAttr\r\n else\r\n idx = colAttr\r\n return if idx < 0 or idx == colAttrs.length-1\r\n for i in [0..idx]\r\n hh = colHeaderHeaders[i]\r\n replaceClass hh.th, classCollapsed, classExpanded\r\n hh.th.textContent = \" \" + arrowExpanded + \" \" + colAttrs[i]\r\n hh.clickStatus = classExpanded\r\n j = 0\r\n nCols = colHeaderCols.length\r\n while j < nCols\r\n h = colHeaderCols[j]\r\n expandCol colHeaderHeaders, colHeaderCols, j if h.col == i\r\n ++j\r\n ++idx\r\n while idx < colAttrs.length-1\r\n colHeaderHeader = colHeaderHeaders[idx]\r\n if colHeaderHeader.expandedCount == 0\r\n replaceClass colHeaderHeader.th, classExpanded, classCollapsed\r\n colHeaderHeader.th.textContent = \" \" + arrowCollapsed + \" \" + colAttrs[idx]\r\n colHeaderHeader.clickStatus = classCollapsed\r\n else if colHeaderHeader.expandedCount == colHeaderHeader.nHeaders\r\n replaceClass colHeaderHeader.th, classCollapsed, classExpanded\r\n colHeaderHeader.th.textContent = \" \" + arrowExpanded + \" \" + colAttrs[idx]\r\n colHeaderHeader.clickStatus = classExpanded\r\n ++idx\r\n\r\n collapseRowsAt = (rowHeaderHeaders, rowHeaderRows, rowAttrs, rowAttr) ->\r\n if typeof rowAttr is 'string'\r\n idx = rowAttrs.indexOf rowAttr\r\n else\r\n idx = rowAttr\r\n\r\n return if idx < 0 or idx == rowAttrs.length-1\r\n\r\n i = idx\r\n nAttrs = rowAttrs.length-1\r\n while i < nAttrs\r\n h = rowHeaderHeaders.hh[i]\r\n replaceClass h.th, classExpanded, classCollapsed\r\n h.th.textContent = \" \" + arrowCollapsed + \" \" + rowAttrs[i]\r\n h.clickStatus = classCollapsed\r\n ++i\r\n j = 0\r\n nRows = rowHeaderRows.length\r\n while j < nRows\r\n h = rowHeaderRows[j]\r\n if h.col is idx and h.clickStatus isnt classCollapsed and h.tr.style.display isnt \"none\"\r\n collapseRow rowHeaderHeaders, rowHeaderRows, j\r\n j = j + h.descendants + 1\r\n else\r\n ++j\r\n\r\n expandRowsAt = (rowHeaderHeaders, rowHeaderRows, rowAttrs, rowAttr) ->\r\n if typeof rowAttr is 'string'\r\n idx = rowAttrs.indexOf rowAttr\r\n else\r\n idx = rowAttr\r\n\r\n return if idx < 0 or idx == rowAttrs.length-1\r\n\r\n for i in [0..idx]\r\n hh = rowHeaderHeaders.hh[i]\r\n replaceClass hh.th, classCollapsed, classExpanded\r\n hh.th.textContent = \" \" + arrowExpanded + \" \" + rowAttrs[i]\r\n hh.clickStatus = classExpanded\r\n j = 0\r\n nRows = rowHeaderRows.length\r\n while j < nRows\r\n h = rowHeaderRows[j]\r\n if h.col == i\r\n expandRow(rowHeaderHeaders, rowHeaderRows, j)\r\n j += h.descendants + 1\r\n else\r\n ++j\r\n ++idx\r\n while idx < rowAttrs.length-1\r\n rowHeaderHeader = rowHeaderHeaders.hh[idx]\r\n if rowHeaderHeader.expandedCount == 0\r\n replaceClass rowHeaderHeader.th, classExpanded, classCollapsed\r\n rowHeaderHeader.th.textContent = \" \" + arrowCollapsed + \" \" + rowAttrs[idx]\r\n rowHeaderHeader.clickStatus = classCollapsed\r\n else if rowHeaderHeader.expandedCount == rowHeaderHeader.nHeaders\r\n replaceClass rowHeaderHeader.th, classCollapsed, classExpanded\r\n rowHeaderHeader.th.textContent = \" \" + arrowExpanded + \" \" + rowAttrs[idx]\r\n rowHeaderHeader.clickStatus = classExpanded\r\n ++idx\r\n\r\n toggleColHeaderHeader = (colHeaderHeaders, colHeaderCols, colAttrs, colAttr) ->\r\n idx = colAttrs.indexOf colAttr\r\n h = colHeaderHeaders[idx]\r\n if h.clickStatus is classCollapsed\r\n expandColsAt colHeaderHeaders, colHeaderCols, colAttrs, colAttr\r\n else\r\n collapseColsAt colHeaderHeaders, colHeaderCols, colAttrs, colAttr\r\n\r\n\r\n toggleRowHeaderHeader = (rowHeaderHeaders, rowHeaderRows, rowAttrs, rowAttr) ->\r\n idx = rowAttrs.indexOf rowAttr\r\n th = rowHeaderHeaders.hh[idx]\r\n if th.clickStatus is classCollapsed\r\n expandRowsAt rowHeaderHeaders, rowHeaderRows, rowAttrs, rowAttr\r\n else\r\n collapseRowsAt rowHeaderHeaders, rowHeaderRows, rowAttrs, rowAttr\r\n\r\n main = (rowAttrs, rowKeys, colAttrs, colKeys) ->\r\n rowHeaders = []\r\n colHeaders = []\r\n rowHeaderHeaders = {}\r\n rowHeaderRows = []\r\n colHeaderHeaders = []\r\n colHeaderCols = []\r\n\r\n rowHeaders = processKeys rowKeys, \"pvtRowLabel\" if rowAttrs.length > 0 and rowKeys.length > 0\r\n colHeaders = processKeys colKeys, \"pvtColLabel\" if colAttrs.length > 0 and colKeys.length > 0\r\n\r\n result = document.createElement \"table\"\r\n result.className = \"pvtTable\"\r\n result.style.display = \"none\"\r\n\r\n thead = document.createElement \"thead\"\r\n result.appendChild thead\r\n\r\n if colAttrs.length > 0\r\n buildColHeaderHeaders thead, colHeaderHeaders, rowAttrs, colAttrs\r\n buildColHeaders colHeaderHeaders, colHeaderCols, h, rowAttrs, colAttrs for h in colHeaders\r\n buildColHeaderHeadersClickEvents colHeaderHeaders, colHeaderCols, colAttrs\r\n\r\n if rowAttrs.length > 0\r\n buildRowHeaderHeaders thead, rowHeaderHeaders, rowAttrs, colAttrs\r\n buildRowTotalsHeader rowHeaderHeaders.tr, rowAttrs, colAttrs if colAttrs.length == 0\r\n\r\n if colAttrs.length > 0\r\n buildRowTotalsHeader colHeaderHeaders[0].tr, rowAttrs, colAttrs\r\n\r\n tbody = document.createElement \"tbody\"\r\n result.appendChild tbody\r\n buildRowHeaders tbody, rowHeaderHeaders, rowHeaderRows, h, rowAttrs, colAttrs for h in rowHeaders if rowAttrs.length > 0\r\n buildRowHeaderHeadersClickEvents rowHeaderHeaders, rowHeaderRows, rowAttrs\r\n buildValues rowHeaderRows, colHeaderCols\r\n tr = buildColTotalsHeader rowAttrs, colAttrs\r\n buildColTotals tr, colHeaderCols if colAttrs.length > 0\r\n buildGrandTotal tbody, tr\r\n\r\n result.setAttribute \"data-numrows\", rowKeys.length\r\n result.setAttribute \"data-numcols\", colKeys.length\r\n result.style.display = \"\" if not opts.collapseRowsAt? and not opts.collapseColsAt?\r\n collapseRowsAt rowHeaderHeaders, rowHeaderRows, rowAttrs, opts.collapseRowsAt if opts.collapseRowsAt?\r\n if not opts.collapseColsAt?\r\n result.style.display = \"\"\r\n return result\r\n collapseColsAt colHeaderHeaders, colHeaderCols, colAttrs, opts.collapseColsAt if opts.collapseColsAt?\r\n result.style.display = \"\"\r\n\r\n return result\r\n\r\n return main rowAttrs, rowKeys, colAttrs, colKeys\r\n\r\n $.pivotUtilities.subtotal_renderers =\r\n \"Table With Subtotal\": (pvtData, opts) -> SubtotalRenderer pvtData, opts\r\n \"Table With Subtotal Bar Chart\": (pvtData, opts) -> $(SubtotalRenderer pvtData, opts).barchart()\r\n \"Table With Subtotal Heatmap\": (pvtData, opts) -> $(SubtotalRenderer pvtData, opts).heatmap \"heatmap\", opts\r\n \"Table With Subtotal Row Heatmap\": (pvtData, opts) -> $(SubtotalRenderer pvtData, opts).heatmap \"rowheatmap\", opts\r\n \"Table With Subtotal Col Heatmap\": (pvtData, opts) -> $(SubtotalRenderer pvtData, opts).heatmap \"colheatmap\", opts\r\n\r\n usFmtPct = $.pivotUtilities.numberFormat digitsAfterDecimal:1, scaler: 100, suffix: \"%\"\r\n aggregatorTemplates = $.pivotUtilities.aggregatorTemplates;\r\n\r\n subtotalAggregatorTemplates =\r\n fractionOf: (wrapped, type=\"row\", formatter=usFmtPct) -> (x...) -> (data, rowKey, colKey) ->\r\n rowKey = [] if typeof rowKey is \"undefined\"\r\n colKey = [] if typeof colKey is \"undefined\"\r\n selector: {row: [rowKey.slice(0, -1),[]], col: [[], colKey.slice(0, -1)]}[type]\r\n inner: wrapped(x...)(data, rowKey, colKey)\r\n push: (record) -> @inner.push record\r\n format: formatter\r\n value: -> @inner.value() / data.getAggregator(@selector...).inner.value()\r\n numInputs: wrapped(x...)().numInputs\r\n\r\n $.pivotUtilities.subtotalAggregatorTemplates = subtotalAggregatorTemplates\r\n\r\n $.pivotUtilities.subtotal_aggregators = do (tpl = aggregatorTemplates, sTpl = subtotalAggregatorTemplates) ->\r\n \"Count As Fraction Of Parent Row\": sTpl.fractionOf(tpl.count(), \"row\", usFmtPct)\r\n \"Count As Fraction Of Parent Column\": sTpl.fractionOf(tpl.count(), \"col\", usFmtPct)\r\n \"Sum As Fraction Of Parent Row\": sTpl.fractionOf(tpl.sum(), \"row\", usFmtPct)\r\n \"Sum As Fraction Of Parent Column\": sTpl.fractionOf(tpl.sum(), \"col\", usFmtPct)\r\n\r\n"]} \ No newline at end of file +{"version":3,"file":"subtotal.js","sources":["subtotal.coffee"],"names":[],"mappings":"AAAA;AAAA,MAAA,cAAA;IAAA;;;;EAAA,cAAA,GAAiB,SAAC,WAAD;IACb,IAAG,OAAO,OAAP,KAAkB,QAAlB,IAA+B,OAAO,MAAP,KAAiB,QAAnD;aACI,WAAA,CAAY,OAAA,CAAQ,QAAR,CAAZ,EADJ;KAAA,MAEK,IAAG,OAAO,MAAP,KAAiB,UAAjB,IAAgC,MAAM,CAAC,GAA1C;aACD,MAAA,CAAO,CAAC,QAAD,CAAP,EAAmB,WAAnB,EADC;KAAA,MAAA;aAID,WAAA,CAAY,MAAZ,EAJC;;EAHQ;;EASjB,cAAA,CAAe,SAAC,CAAD;AAEX,QAAA;IAAM;AACF,UAAA;;;;MAAa,2BAAC,KAAD,EAAQ,IAAR;QACT,mDAAM,KAAN,EAAa,IAAb;MADS;;MAGb,UAAA,GAAa,SAAC,MAAD,EAAS,MAAT,EAAiB,IAAjB,EAAuB,KAAvB,EAA8B,aAA9B;AACT,YAAA;QAAA,GAAA,GAAM;QACN,MAAA,GAAS;AACT,aAAA,uCAAA;;UACI,GAAG,CAAC,IAAJ,sCAAwB,MAAxB;UACA,OAAA,GAAU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C,IAAI,CAAC,UAAL,CAAgB,GAAG,CAAC,KAAJ,CAAA,CAAhB,EAA6B,KAA7B,EAAoC,QAApC,CAHxC;;IADuC,CAAA,CAAH,CAAU,mBAAV,EAAsC,2BAAtC;EAtuB7B,CAAf;AATA","sourcesContent":["callWithJQuery = (pivotModule) ->\r\n if typeof exports is \"object\" and typeof module is \"object\" # CommonJS\r\n pivotModule require(\"jquery\")\r\n else if typeof define is \"function\" and define.amd # AMD\r\n define [\"jquery\"], pivotModule\r\n # Plain browser env\r\n else\r\n pivotModule jQuery\r\n\r\ncallWithJQuery ($) ->\r\n\r\n class SubtotalPivotData extends $.pivotUtilities.PivotData\r\n constructor: (input, opts) ->\r\n super input, opts\r\n\r\n processKey = (record, totals, keys, attrs, getAggregator) ->\r\n key = []\r\n addKey = false\r\n for attr in attrs\r\n key.push record[attr] ? \"null\"\r\n flatKey = key.join String.fromCharCode(0)\r\n if not totals[flatKey]\r\n totals[flatKey] = getAggregator key.slice()\r\n addKey = true\r\n totals[flatKey].push record\r\n keys.push key if addKey\r\n return key\r\n\r\n processRecord: (record) -> #this code is called in a tight loop\r\n rowKey = []\r\n colKey = []\r\n\r\n @allTotal.push record\r\n rowKey = processKey record, @rowTotals, @rowKeys, @rowAttrs, (key) =>\r\n return @aggregator this, key, []\r\n colKey = processKey record, @colTotals, @colKeys, @colAttrs, (key) =>\r\n return @aggregator this, [], key\r\n m = rowKey.length-1\r\n n = colKey.length-1\r\n return if m < 0 or n < 0\r\n for i in [0..m]\r\n fRowKey = rowKey.slice(0, i+1)\r\n flatRowKey = fRowKey.join String.fromCharCode(0)\r\n @tree[flatRowKey] = {} if not @tree[flatRowKey]\r\n for j in [0..n]\r\n fColKey = colKey.slice 0, j+1\r\n flatColKey = fColKey.join String.fromCharCode(0)\r\n @tree[flatRowKey][flatColKey] = @aggregator this, fRowKey, fColKey if not @tree[flatRowKey][flatColKey]\r\n @tree[flatRowKey][flatColKey].push record\r\n\r\n $.pivotUtilities.SubtotalPivotData = SubtotalPivotData\r\n\r\n SubtotalRenderer = (pivotData, opts) ->\r\n defaults =\r\n table: clickCallback: null\r\n localeStrings: totals: \"Totals\"\r\n\r\n opts = $.extend true, {}, defaults, opts\r\n\r\n arrowCollapsed = opts.arrowCollapsed ?= \"\\u25B6\"\r\n arrowExpanded = opts.arrowExpanded ?= \"\\u25E2\"\r\n classExpanded = \"expanded\"\r\n classCollapsed = \"collapsed\"\r\n colAttrs = pivotData.colAttrs\r\n rowAttrs = pivotData.rowAttrs\r\n rowKeys = pivotData.getRowKeys()\r\n colKeys = pivotData.getColKeys()\r\n tree = pivotData.tree\r\n rowTotals = pivotData.rowTotals\r\n colTotals = pivotData.colTotals\r\n allTotal = pivotData.allTotal\r\n\r\n # Based on http://stackoverflow.com/questions/195951/change-an-elements-class-with-javascript -- Begin\r\n hasClass = (element, className) ->\r\n regExp = new RegExp \"(?:^|\\\\s)\" + className + \"(?!\\\\S)\", \"g\"\r\n element.className.match regExp\r\n\r\n removeClass = (element, className) ->\r\n regExp = new RegExp \"(?:^|\\\\s)\" + className + \"(?!\\\\S)\", \"g\"\r\n element.className = element.className.replace regExp, ''\r\n\r\n addClass = (element, className) ->\r\n element.className += (\" \" + className) if not hasClass element, className\r\n\r\n replaceClass = (element, replaceClassName, byClassName) ->\r\n removeClass element, replaceClassName\r\n addClass element, byClassName\r\n # Based on http://stackoverflow.com/questions/195951/change-an-elements-class-with-javascript -- End\r\n\r\n getTableEventHandlers = (value, rowValues, colValues) ->\r\n return if not opts.table and not opts.table.eventHandlers\r\n eventHandlers = {}\r\n for own event, handler of opts.table.eventHandlers\r\n filters = {}\r\n filters[attr] = colValues[i] for own i, attr of colAttrs when colValues[i]?\r\n filters[attr] = rowValues[i] for own i, attr of rowAttrs when rowValues[i]?\r\n eventHandlers[event] = (e) -> handler(e, value, filters, pivotData)\r\n return eventHandlers\r\n\r\n createCell = (cellType, className, textContent, attributes, eventHandlers) ->\r\n th = document.createElement cellType\r\n th.className = className if className?\r\n th.textContent = textContent if textContent?\r\n th.setAttribute attr, val for own attr, val of attributes if attributes?\r\n th.addEventListener event, handler for own event, handler of eventHandlers if eventHandlers?\r\n return th\r\n\r\n processKeys = (keysArr, className) ->\r\n headers = []\r\n lastRow = keysArr.length - 1\r\n lastCol = keysArr[0].length - 1\r\n rMark = []\r\n th = createCell \"th\", className, keysArr[0][0]\r\n key = []\r\n key.push keysArr[0][0]\r\n nodePos = 0\r\n node = {\r\n node: nodePos,\r\n row: 0,\r\n col: 0,\r\n th: th,\r\n parent: null,\r\n children: [],\r\n descendants: lastCol,\r\n leaves: 1,\r\n key: key,\r\n flatKey: key.join String.fromCharCode(0)}\r\n headers.push node\r\n rMark[0] = node\r\n c = 1\r\n while c <= lastCol\r\n th = createCell \"th\", className, keysArr[0][c]\r\n key = key.slice()\r\n key.push keysArr[0][c]\r\n ++nodePos\r\n node = {\r\n node: nodePos,\r\n row: 0,\r\n col: c,\r\n th: th,\r\n parent: rMark[c-1],\r\n children: [],\r\n descendants: lastCol-c,\r\n leaves: 1,\r\n key: key,\r\n flatKey: key.join String.fromCharCode(0)}\r\n rMark[c] = node\r\n rMark[c-1].children.push node\r\n ++c\r\n rMark[lastCol].leaves = 0\r\n r = 1\r\n while r <= lastRow\r\n repeats = true\r\n key = []\r\n c = 0\r\n while c <= lastCol\r\n key = key.slice()\r\n key.push keysArr[r][c]\r\n if ((keysArr[r][c] is keysArr[rMark[c].row][c]) and (c isnt lastCol) and (repeats))\r\n repeats = true\r\n ++c\r\n continue\r\n th = createCell \"th\", className, keysArr[r][c]\r\n ++nodePos\r\n node = {\r\n node: nodePos,\r\n row: r,\r\n col: c,\r\n th: th,\r\n parent: null,\r\n children: [],\r\n descendants: 0,\r\n leaves: 1,\r\n key: key,\r\n flatKey: key.join String.fromCharCode(0)}\r\n if c is 0\r\n headers.push node\r\n else\r\n node.parent = rMark[c-1]\r\n rMark[c-1].children.push node\r\n x = 0\r\n while x <= c-1\r\n ++rMark[x].descendants\r\n ++x\r\n rMark[c] = node\r\n repeats = false\r\n ++c\r\n ++rMark[c].leaves for c in [0..lastCol]\r\n rMark[lastCol].leaves = 0\r\n ++r\r\n return headers\r\n\r\n buildColHeaderHeader = (thead, colHeaderHeaders, rowAttrs, colAttrs, tr, col) ->\r\n colAttr = colAttrs[col]\r\n textContent = colAttr\r\n className = \"pvtAxisLabel\"\r\n if col < colAttrs.length-1\r\n className += \" expanded\"\r\n textContent = \" \" + arrowExpanded + \" \" + colAttr\r\n th = createCell \"th\", className, textContent\r\n th.setAttribute \"data-colAttr\", colAttr\r\n tr.appendChild th\r\n colHeaderHeaders.push {\r\n tr: tr,\r\n th: th,\r\n clickStatus: classExpanded,\r\n expandedCount: 0,\r\n nHeaders: 0}\r\n thead.appendChild tr\r\n\r\n buildColHeaderHeaders = (thead, colHeaderHeaders, rowAttrs, colAttrs) ->\r\n tr = document.createElement \"tr\"\r\n if rowAttrs.length != 0\r\n tr.appendChild createCell \"th\", null, null, {\r\n colspan: rowAttrs.length,\r\n rowspan: colAttrs.length}\r\n buildColHeaderHeader thead, colHeaderHeaders, rowAttrs, colAttrs, tr, 0\r\n for c in [1..colAttrs.length] when c < colAttrs.length\r\n tr = document.createElement(\"tr\")\r\n buildColHeaderHeader thead, colHeaderHeaders, rowAttrs, colAttrs, tr, c\r\n\r\n buildColHeaderHeadersClickEvents = (colHeaderHeaders, colHeaderCols, colAttrs) ->\r\n n = colAttrs.length-1\r\n for i in [0..n] when i < n\r\n th = colHeaderHeaders[i].th\r\n colAttr = colAttrs[i]\r\n th.onclick = (event) ->\r\n event = event || window.event\r\n toggleColHeaderHeader colHeaderHeaders, colHeaderCols, colAttrs, event.target.getAttribute \"data-colAttr\"\r\n\r\n buildColHeaders = (colHeaderHeaders, colHeaderCols, colHeader, rowAttrs, colAttrs) ->\r\n # DF Recurse\r\n for h in colHeader.children\r\n buildColHeaders colHeaderHeaders, colHeaderCols, h, rowAttrs, colAttrs\r\n # Process\r\n hh = colHeaderHeaders[colHeader.col]\r\n ++hh.expandedCount\r\n ++hh.nHeaders\r\n tr = hh.tr\r\n th = colHeader.th\r\n th.setAttribute \"data-colHeader\", th.textContent\r\n th.setAttribute(\"rowspan\", 2) if colHeader.col == colAttrs.length-1 and rowAttrs.length != 0\r\n th.setAttribute(\"colspan\", colHeader.descendants+1) if colHeader.children.length !=0\r\n th.setAttribute(\"data-node\", colHeaderCols.length)\r\n tr.appendChild(th)\r\n if colHeader.children.length != 0\r\n addClass th, classExpanded\r\n th.textContent = \" \" + arrowExpanded + \" \" + th.textContent\r\n th.onclick = (event) ->\r\n event = event || window.event\r\n toggleCol colHeaderHeaders, colHeaderCols, parseInt event.target.getAttribute \"data-node\"\r\n rowspan = colAttrs.length-(colHeader.col+1) + if rowAttrs.length != 0 then 1 else 0\r\n style = \"pvtColLabel pvtColSubtotal col\" + colHeader.row\r\n th = createCell \"th\", style, '', {\"rowspan\": rowspan}\r\n colHeader.children[0].tr.appendChild th\r\n colHeader.sTh = th\r\n colHeader.clickStatus = classExpanded\r\n colHeader.tr = tr\r\n colHeaderCols.push colHeader\r\n\r\n buildRowHeaderHeaders = (thead, rowHeaderHeaders, rowAttrs, colAttrs) ->\r\n tr = document.createElement \"tr\"\r\n rowHeaderHeaders.hh = []\r\n for own i, rowAttr of rowAttrs\r\n textContent = rowAttr\r\n className = \"pvtAxisLabel\"\r\n if i < rowAttrs.length-1\r\n className += \" expanded\"\r\n textContent = \" \" + arrowExpanded + \" \" + rowAttr\r\n th = createCell \"th\", className, textContent\r\n th.setAttribute \"data-rowAttr\", rowAttr\r\n tr.appendChild th\r\n rowHeaderHeaders.hh.push {\r\n th: th,\r\n clickStatus: classExpanded,\r\n expandedCount: 0,\r\n nHeaders: 0}\r\n if colAttrs.length != 0\r\n th = createCell \"th\"\r\n tr.appendChild th\r\n thead.appendChild tr\r\n rowHeaderHeaders.tr = tr\r\n\r\n buildRowHeaderHeadersClickEvents = (rowHeaderHeaders, rowHeaderRows, rowAttrs) ->\r\n n = rowAttrs.length-1\r\n for i in [0..n] when i < n\r\n th = rowHeaderHeaders.hh[i]\r\n rowAttr = rowAttrs[i]\r\n th.th.onclick = (event) ->\r\n event = event || window.event\r\n toggleRowHeaderHeader rowHeaderHeaders, rowHeaderRows, rowAttrs, event.target.getAttribute \"data-rowAttr\"\r\n\r\n buildRowTotalsHeader = (tr, rowAttrs, colAttrs) ->\r\n rowspan = 1\r\n if colAttrs.length != 0\r\n rowspan = colAttrs.length + (if rowAttrs.length == 0 then 0 else 1)\r\n th = createCell \"th\", \"pvtTotalLabel rowTotal\", opts.localeStrings.totals, {rowspan: rowspan}\r\n tr.appendChild th\r\n\r\n buildRowHeaders = (tbody, rowHeaderHeaders, rowHeaderRows, rowHeader, rowAttrs, colAttrs) ->\r\n hh = rowHeaderHeaders.hh[rowHeader.col]\r\n ++hh.expandedCount\r\n ++hh.nHeaders\r\n tr = document.createElement \"tr\"\r\n th = rowHeader.th\r\n th.setAttribute \"rowspan\", rowHeader.descendants+1\r\n th.setAttribute \"data-rowHeader\", th.textContent\r\n if rowHeader.col == rowAttrs.length-1 and colAttrs.length != 0\r\n th.setAttribute \"colspan\", 2\r\n th.setAttribute \"data-node\", rowHeaderRows.length\r\n tr.appendChild th\r\n if rowHeader.children.length != 0\r\n addClass th, classExpanded\r\n th.textContent = \" \" + arrowExpanded + \" \" + th.textContent\r\n th.onclick = (event) ->\r\n event = event || window.event\r\n toggleRow rowHeaderHeaders, rowHeaderRows, parseInt event.target.getAttribute \"data-node\"\r\n colspan = rowAttrs.length-(rowHeader.col+1) + if colAttrs.length != 0 then 1 else 0\r\n th = createCell \"th\", \"pvtRowLabel pvtRowSubtotal\", '', {colspan: colspan}\r\n tr.appendChild th\r\n rowHeader.clickStatus = classExpanded\r\n rowHeader.tr = tr\r\n rowHeaderRows.push rowHeader\r\n tbody.appendChild tr\r\n for h in rowHeader.children\r\n buildRowHeaders tbody, rowHeaderHeaders, rowHeaderRows, h, rowAttrs, colAttrs\r\n\r\n buildValues = (rowHeaderRows, colHeaderCols) ->\r\n for rowHeader in rowHeaderRows\r\n tr = rowHeader.tr\r\n flatRowKey = rowHeader.flatKey\r\n for colHeader in colHeaderCols\r\n flatColKey = colHeader.flatKey\r\n aggregator = tree[flatRowKey][flatColKey] ? {value: (-> null), format: -> \"\"}\r\n val = aggregator.value()\r\n style = \"pvtVal\"\r\n style += \" pvtColSubtotal\" if colHeader.children.length != 0\r\n style += \" pvtRowSubtotal\" if rowHeader.children.length != 0\r\n style += \" row\" + rowHeader.row +\r\n \" col\" + colHeader.row +\r\n \" rowcol\" + rowHeader.col +\r\n \" colcol\" + colHeader.col\r\n eventHandlers = getTableEventHandlers val, rowHeader.key, colHeader.key\r\n td = createCell \"td\", style, aggregator.format(val), {\"data-value\": val}, eventHandlers\r\n tr.appendChild td\r\n # buildRowTotal\r\n totalAggregator = rowTotals[flatRowKey]\r\n val = totalAggregator.value()\r\n style = \"pvtTotal rowTotal\"\r\n style += \" pvtRowSubtotal\" if rowHeader.children.length != 0\r\n style += \" row\" + rowHeader.row + \" rowcol\" + rowHeader.col\r\n td = createCell \"td\", style, totalAggregator.format(val), {\r\n \"data-value\": val,\r\n \"data-row\": \"row\"+rowHeader.row,\r\n \"data-col\": \"col\"+rowHeader.col}, getTableEventHandlers val, rowHeader.key, []\r\n tr.appendChild td\r\n\r\n buildColTotalsHeader = (rowAttrs, colAttrs) ->\r\n tr = document.createElement \"tr\"\r\n colspan = rowAttrs.length + (if colAttrs.length == 0 then 0 else 1)\r\n th = createCell \"th\", \"pvtTotalLabel colTotal\", opts.localeStrings.totals, {colspan: colspan}\r\n tr.appendChild th\r\n return tr\r\n\r\n buildColTotals = (tr, colHeaderCols) ->\r\n for h in colHeaderCols\r\n totalAggregator = colTotals[h.flatKey]\r\n val = totalAggregator.value()\r\n style = \"pvtVal pvtTotal colTotal\"\r\n style += \" pvtColSubtotal\" if h.children.length != 0\r\n style += \" col\" + h.row + \" colcol\" + h.col\r\n td = createCell \"td\", style, totalAggregator.format(val),\r\n {\"data-value\": val, \"data-for\": \"col\" + h.col},\r\n getTableEventHandlers val, [], h.key\r\n tr.appendChild td\r\n\r\n buildGrandTotal = (result, tr) ->\r\n totalAggregator = allTotal\r\n val = totalAggregator.value()\r\n td = createCell \"td\", \"pvtGrandTotal\", totalAggregator.format(val),\r\n {\"data-value\": val},\r\n getTableEventHandlers val, [], []\r\n tr.appendChild td\r\n result.appendChild tr\r\n\r\n setColVisibility = (visibility, h) ->\r\n h.th.style.display = visibility\r\n if h.children.length != 0\r\n $(h.th).closest 'table.pvtTable'\r\n .find 'tbody tr td.pvtColSubtotal.col' + h.row + '.colcol' + h.col\r\n .css 'display', visibility\r\n else\r\n $(h.th)\r\n .closest 'table.pvtTable'\r\n .find 'tbody tr td.pvtVal.col' + h.row\r\n .not '.pvtColSubtotal'\r\n .css 'display', visibility\r\n h.sTh.style.display = visibility if h.sTh\r\n\r\n collapseCol = (colHeaderHeaders, colHeaderCols, c) ->\r\n return if not colHeaderCols[c]\r\n\r\n h = colHeaderCols[c]\r\n return if h.clickStatus is classCollapsed\r\n\r\n colspan = 0\r\n for i in [1..h.descendants] when h.descendants != 0\r\n d = colHeaderCols[c-i]\r\n if d.th.style.display isnt \"none\"\r\n ++colspan\r\n setColVisibility \"none\", d\r\n p = h.parent\r\n while p isnt null\r\n p.th.setAttribute(\"colspan\", parseInt(p.th.getAttribute(\"colspan\")) - colspan)\r\n p = p.parent\r\n if h.descendants != 0\r\n replaceClass h.th, classExpanded, classCollapsed\r\n h.th.textContent = \" \" + arrowCollapsed + \" \" + h.th.getAttribute \"data-colHeader\"\r\n h.clickStatus = classCollapsed\r\n h.th.setAttribute \"colspan\", 1\r\n h.th.style.display = \"\"\r\n colHeaderHeader = colHeaderHeaders[h.col]\r\n colHeaderHeader.expandedCount--\r\n if colHeaderHeader.expandedCount == 0\r\n for i in [h.col..colHeaderHeaders.length-2]\r\n colHeaderHeader = colHeaderHeaders[i]\r\n replaceClass colHeaderHeader.th, classExpanded, classCollapsed\r\n colHeaderHeader.th.textContent = \" \" + arrowCollapsed + \" \" + colHeaderHeader.th.getAttribute \"data-colAttr\"\r\n colHeaderHeader.clickStatus = classCollapsed\r\n\r\n expandChildCol = (ch) ->\r\n setColVisibility \"\", ch if ch.th.style.display is \"none\"\r\n expandChildCol gch for gch in ch.children if ch.clickStatus isnt classCollapsed\r\n\r\n expandCol = (colHeaderHeaders, colHeaderCols, c) ->\r\n return if not colHeaderCols[c]\r\n\r\n h = colHeaderCols[c]\r\n return if h.clickStatus is classExpanded\r\n\r\n colspan = 0\r\n for ch in h.children\r\n colspan += ch.th.colSpan\r\n setColVisibility \"\", ch if ch.th.style.display is \"none\"\r\n expandChildCol ch\r\n if h.descendants != 0\r\n replaceClass h.th, classCollapsed, classExpanded\r\n h.th.textContent = \" \" + arrowExpanded + \" \" + h.th.getAttribute \"data-colHeader\"\r\n h.th.setAttribute \"colspan\", colspan+1\r\n h.clickStatus = classExpanded\r\n h.th.style.display = \"\"\r\n h.sTh.style.display = \"\" if h.sTh?\r\n p = h.parent\r\n while p isnt null\r\n p.th.setAttribute \"colspan\", colspan + parseInt p.th.getAttribute \"colspan\"\r\n p = p.parent\r\n hh = colHeaderHeaders[h.col]\r\n ++hh.expandedCount\r\n if hh.expandedCount is hh.nHeaders\r\n replaceClass hh.th, classCollapsed, classExpanded\r\n hh.th.textContent = \" \" + arrowExpanded + \" \" + hh.th.getAttribute \"data-colAttr\"\r\n hh.clickStatus = classExpanded\r\n\r\n collapseRow = (rowHeaderHeaders, rowHeaderRows, r) ->\r\n return if not rowHeaderRows[r]\r\n\r\n h = rowHeaderRows[r]\r\n return if h.clickStatus is classCollapsed\r\n\r\n rowspan = 0\r\n for i in [1..h.descendants] when h.descendants != 0\r\n d = rowHeaderRows[r+i]\r\n if d.tr.style.display isnt \"none\"\r\n ++rowspan\r\n d.tr.style.display = \"none\"\r\n p = h.parent\r\n while p isnt null\r\n p.th.setAttribute \"rowspan\", parseInt p.th.getAttribute(\"rowspan\")-rowspan\r\n p = p.parent\r\n if h.descendants != 0\r\n replaceClass h.th, classExpanded, classCollapsed\r\n h.th.textContent = \" \" + arrowCollapsed + \" \" + h.th.getAttribute \"data-rowHeader\"\r\n h.clickStatus = classCollapsed\r\n h.th.setAttribute \"rowspan\", 1\r\n h.tr.style.display = \"\"\r\n rowHeaderHeader = rowHeaderHeaders.hh[h.col]\r\n rowHeaderHeader.expandedCount--\r\n return if rowHeaderHeader.expandedCount != 0\r\n for j in [h.col..rowHeaderHeaders.hh.length-2]\r\n rowHeaderHeader = rowHeaderHeaders.hh[j]\r\n replaceClass rowHeaderHeader.th, classExpanded, classCollapsed\r\n rowHeaderHeader.th.textContent =\r\n \" \" + arrowCollapsed + \" \" + rowHeaderHeader.th.getAttribute \"data-rowAttr\"\r\n rowHeaderHeader.clickStatus = classCollapsed\r\n\r\n expandChildRow = (ch) ->\r\n ch.tr.style.display = \"\" if ch.tr.style.display is \"none\"\r\n expandChildRow gch for gch in ch.children if ch.clickStatus isnt classCollapsed\r\n\r\n expandRow = (rowHeaderHeaders, rowHeaderRows, r) ->\r\n return if not rowHeaderRows[r]\r\n\r\n h = rowHeaderRows[r]\r\n return if h.clickStatus is classExpanded\r\n\r\n rowspan = 0\r\n for ch in h.children\r\n rowspan += ch.th.rowSpan\r\n ch.tr.style.display = \"\" if ch.tr.style.display is \"none\"\r\n expandChildRow ch\r\n if h.descendants != 0\r\n replaceClass h.th, classCollapsed, classExpanded\r\n h.th.textContent = \" \" + arrowExpanded + \" \" + h.th.getAttribute \"data-rowHeader\"\r\n h.th.setAttribute \"rowspan\", rowspan+1\r\n h.clickStatus = classExpanded\r\n h.tr.style.display = \"\"\r\n p = h.parent\r\n while p isnt null\r\n p.th.setAttribute \"rowspan\", rowspan + parseInt p.th.getAttribute \"rowspan\"\r\n p = p.parent\r\n hh = rowHeaderHeaders.hh[h.col]\r\n ++hh.expandedCount\r\n if hh.expandedCount == hh.nHeaders\r\n replaceClass hh.th, classCollapsed, classExpanded\r\n hh.th.textContent = \" \" + arrowExpanded + \" \" + hh.th.getAttribute \"data-rowAttr\"\r\n hh.clickStatus = classExpanded\r\n\r\n toggleCol = (colHeaderHeaders, colHeaderCols, c) ->\r\n return if not colHeaderCols[c]?\r\n\r\n h = colHeaderCols[c]\r\n if h.clickStatus is classCollapsed\r\n expandCol(colHeaderHeaders, colHeaderCols, c)\r\n else\r\n collapseCol(colHeaderHeaders, colHeaderCols, c)\r\n h.th.scrollIntoView\r\n\r\n toggleRow = (rowHeaderHeaders, rowHeaderRows, r) ->\r\n return if not rowHeaderRows[r]?\r\n\r\n if rowHeaderRows[r].clickStatus is classCollapsed\r\n expandRow(rowHeaderHeaders, rowHeaderRows, r)\r\n else\r\n collapseRow(rowHeaderHeaders, rowHeaderRows, r)\r\n\r\n collapseColsAt = (colHeaderHeaders, colHeaderCols, colAttrs, colAttr) ->\r\n if typeof colAttr is 'string'\r\n idx = colAttrs.indexOf colAttr\r\n else\r\n idx = colAttr\r\n return if idx < 0 or idx == colAttrs.length-1\r\n i = idx\r\n nAttrs = colAttrs.length-1\r\n while i < nAttrs\r\n hh = colHeaderHeaders[i]\r\n replaceClass hh.th, classExpanded, classCollapsed\r\n hh.th.textContent = \" \" + arrowCollapsed + \" \" + colAttrs[i]\r\n hh.clickStatus = classCollapsed\r\n ++i\r\n i = 0\r\n nCols = colHeaderCols.length\r\n while i < nCols\r\n h = colHeaderCols[i]\r\n if h.col is idx and h.clickStatus isnt classCollapsed and h.th.style.display isnt \"none\"\r\n collapseCol colHeaderHeaders, colHeaderCols, parseInt h.th.getAttribute(\"data-node\")\r\n ++i\r\n\r\n expandColsAt = (colHeaderHeaders, colHeaderCols, colAttrs, colAttr) ->\r\n if typeof colAttr is 'string'\r\n idx = colAttrs.indexOf colAttr\r\n else\r\n idx = colAttr\r\n return if idx < 0 or idx == colAttrs.length-1\r\n for i in [0..idx]\r\n hh = colHeaderHeaders[i]\r\n replaceClass hh.th, classCollapsed, classExpanded\r\n hh.th.textContent = \" \" + arrowExpanded + \" \" + colAttrs[i]\r\n hh.clickStatus = classExpanded\r\n j = 0\r\n nCols = colHeaderCols.length\r\n while j < nCols\r\n h = colHeaderCols[j]\r\n expandCol colHeaderHeaders, colHeaderCols, j if h.col == i\r\n ++j\r\n ++idx\r\n while idx < colAttrs.length-1\r\n colHeaderHeader = colHeaderHeaders[idx]\r\n if colHeaderHeader.expandedCount == 0\r\n replaceClass colHeaderHeader.th, classExpanded, classCollapsed\r\n colHeaderHeader.th.textContent = \" \" + arrowCollapsed + \" \" + colAttrs[idx]\r\n colHeaderHeader.clickStatus = classCollapsed\r\n else if colHeaderHeader.expandedCount == colHeaderHeader.nHeaders\r\n replaceClass colHeaderHeader.th, classCollapsed, classExpanded\r\n colHeaderHeader.th.textContent = \" \" + arrowExpanded + \" \" + colAttrs[idx]\r\n colHeaderHeader.clickStatus = classExpanded\r\n ++idx\r\n\r\n collapseRowsAt = (rowHeaderHeaders, rowHeaderRows, rowAttrs, rowAttr) ->\r\n if typeof rowAttr is 'string'\r\n idx = rowAttrs.indexOf rowAttr\r\n else\r\n idx = rowAttr\r\n\r\n return if idx < 0 or idx == rowAttrs.length-1\r\n\r\n i = idx\r\n nAttrs = rowAttrs.length-1\r\n while i < nAttrs\r\n h = rowHeaderHeaders.hh[i]\r\n replaceClass h.th, classExpanded, classCollapsed\r\n h.th.textContent = \" \" + arrowCollapsed + \" \" + rowAttrs[i]\r\n h.clickStatus = classCollapsed\r\n ++i\r\n j = 0\r\n nRows = rowHeaderRows.length\r\n while j < nRows\r\n h = rowHeaderRows[j]\r\n if h.col is idx and h.clickStatus isnt classCollapsed and h.tr.style.display isnt \"none\"\r\n collapseRow rowHeaderHeaders, rowHeaderRows, j\r\n j = j + h.descendants + 1\r\n else\r\n ++j\r\n\r\n expandRowsAt = (rowHeaderHeaders, rowHeaderRows, rowAttrs, rowAttr) ->\r\n if typeof rowAttr is 'string'\r\n idx = rowAttrs.indexOf rowAttr\r\n else\r\n idx = rowAttr\r\n\r\n return if idx < 0 or idx == rowAttrs.length-1\r\n\r\n for i in [0..idx]\r\n hh = rowHeaderHeaders.hh[i]\r\n replaceClass hh.th, classCollapsed, classExpanded\r\n hh.th.textContent = \" \" + arrowExpanded + \" \" + rowAttrs[i]\r\n hh.clickStatus = classExpanded\r\n j = 0\r\n nRows = rowHeaderRows.length\r\n while j < nRows\r\n h = rowHeaderRows[j]\r\n if h.col == i\r\n expandRow(rowHeaderHeaders, rowHeaderRows, j)\r\n j += h.descendants + 1\r\n else\r\n ++j\r\n ++idx\r\n while idx < rowAttrs.length-1\r\n rowHeaderHeader = rowHeaderHeaders.hh[idx]\r\n if rowHeaderHeader.expandedCount == 0\r\n replaceClass rowHeaderHeader.th, classExpanded, classCollapsed\r\n rowHeaderHeader.th.textContent = \" \" + arrowCollapsed + \" \" + rowAttrs[idx]\r\n rowHeaderHeader.clickStatus = classCollapsed\r\n else if rowHeaderHeader.expandedCount == rowHeaderHeader.nHeaders\r\n replaceClass rowHeaderHeader.th, classCollapsed, classExpanded\r\n rowHeaderHeader.th.textContent = \" \" + arrowExpanded + \" \" + rowAttrs[idx]\r\n rowHeaderHeader.clickStatus = classExpanded\r\n ++idx\r\n\r\n toggleColHeaderHeader = (colHeaderHeaders, colHeaderCols, colAttrs, colAttr) ->\r\n idx = colAttrs.indexOf colAttr\r\n h = colHeaderHeaders[idx]\r\n if h.clickStatus is classCollapsed\r\n expandColsAt colHeaderHeaders, colHeaderCols, colAttrs, colAttr\r\n else\r\n collapseColsAt colHeaderHeaders, colHeaderCols, colAttrs, colAttr\r\n\r\n\r\n toggleRowHeaderHeader = (rowHeaderHeaders, rowHeaderRows, rowAttrs, rowAttr) ->\r\n idx = rowAttrs.indexOf rowAttr\r\n th = rowHeaderHeaders.hh[idx]\r\n if th.clickStatus is classCollapsed\r\n expandRowsAt rowHeaderHeaders, rowHeaderRows, rowAttrs, rowAttr\r\n else\r\n collapseRowsAt rowHeaderHeaders, rowHeaderRows, rowAttrs, rowAttr\r\n\r\n main = (rowAttrs, rowKeys, colAttrs, colKeys) ->\r\n rowHeaders = []\r\n colHeaders = []\r\n rowHeaderHeaders = {}\r\n rowHeaderRows = []\r\n colHeaderHeaders = []\r\n colHeaderCols = []\r\n\r\n rowHeaders = processKeys rowKeys, \"pvtRowLabel\" if rowAttrs.length > 0 and rowKeys.length > 0\r\n colHeaders = processKeys colKeys, \"pvtColLabel\" if colAttrs.length > 0 and colKeys.length > 0\r\n\r\n result = document.createElement \"table\"\r\n result.className = \"pvtTable\"\r\n result.style.display = \"none\"\r\n\r\n thead = document.createElement \"thead\"\r\n result.appendChild thead\r\n\r\n if colAttrs.length > 0\r\n buildColHeaderHeaders thead, colHeaderHeaders, rowAttrs, colAttrs\r\n buildColHeaders colHeaderHeaders, colHeaderCols, h, rowAttrs, colAttrs for h in colHeaders\r\n buildColHeaderHeadersClickEvents colHeaderHeaders, colHeaderCols, colAttrs\r\n\r\n if rowAttrs.length > 0\r\n buildRowHeaderHeaders thead, rowHeaderHeaders, rowAttrs, colAttrs\r\n buildRowTotalsHeader rowHeaderHeaders.tr, rowAttrs, colAttrs if colAttrs.length == 0\r\n\r\n if colAttrs.length > 0\r\n buildRowTotalsHeader colHeaderHeaders[0].tr, rowAttrs, colAttrs\r\n\r\n tbody = document.createElement \"tbody\"\r\n result.appendChild tbody\r\n buildRowHeaders tbody, rowHeaderHeaders, rowHeaderRows, h, rowAttrs, colAttrs for h in rowHeaders if rowAttrs.length > 0\r\n buildRowHeaderHeadersClickEvents rowHeaderHeaders, rowHeaderRows, rowAttrs\r\n buildValues rowHeaderRows, colHeaderCols\r\n tr = buildColTotalsHeader rowAttrs, colAttrs\r\n buildColTotals tr, colHeaderCols if colAttrs.length > 0\r\n buildGrandTotal tbody, tr\r\n\r\n result.setAttribute \"data-numrows\", rowKeys.length\r\n result.setAttribute \"data-numcols\", colKeys.length\r\n result.style.display = \"\" if not opts.collapseRowsAt? and not opts.collapseColsAt?\r\n collapseRowsAt rowHeaderHeaders, rowHeaderRows, rowAttrs, opts.collapseRowsAt if opts.collapseRowsAt?\r\n if not opts.collapseColsAt?\r\n result.style.display = \"\"\r\n return result\r\n collapseColsAt colHeaderHeaders, colHeaderCols, colAttrs, opts.collapseColsAt if opts.collapseColsAt?\r\n result.style.display = \"\"\r\n\r\n return result\r\n\r\n return main rowAttrs, rowKeys, colAttrs, colKeys\r\n\r\n $.pivotUtilities.subtotal_renderers =\r\n \"Table With Subtotal\": (pvtData, opts) -> SubtotalRenderer pvtData, opts\r\n \"Table With Subtotal Bar Chart\": (pvtData, opts) -> $(SubtotalRenderer pvtData, opts).barchart()\r\n \"Table With Subtotal Heatmap\": (pvtData, opts) -> $(SubtotalRenderer pvtData, opts).heatmap \"heatmap\", opts\r\n \"Table With Subtotal Row Heatmap\": (pvtData, opts) -> $(SubtotalRenderer pvtData, opts).heatmap \"rowheatmap\", opts\r\n \"Table With Subtotal Col Heatmap\": (pvtData, opts) -> $(SubtotalRenderer pvtData, opts).heatmap \"colheatmap\", opts\r\n\r\n usFmtPct = $.pivotUtilities.numberFormat digitsAfterDecimal:1, scaler: 100, suffix: \"%\"\r\n aggregatorTemplates = $.pivotUtilities.aggregatorTemplates;\r\n\r\n subtotalAggregatorTemplates =\r\n fractionOf: (wrapped, type=\"row\", formatter=usFmtPct) -> (x...) -> (data, rowKey, colKey) ->\r\n rowKey = [] if typeof rowKey is \"undefined\"\r\n colKey = [] if typeof colKey is \"undefined\"\r\n selector: {row: [rowKey.slice(0, -1),[]], col: [[], colKey.slice(0, -1)]}[type]\r\n inner: wrapped(x...)(data, rowKey, colKey)\r\n push: (record) -> @inner.push record\r\n format: formatter\r\n value: -> @inner.value() / data.getAggregator(@selector...).inner.value()\r\n numInputs: wrapped(x...)().numInputs\r\n\r\n $.pivotUtilities.subtotalAggregatorTemplates = subtotalAggregatorTemplates\r\n\r\n $.pivotUtilities.subtotal_aggregators = do (tpl = aggregatorTemplates, sTpl = subtotalAggregatorTemplates) ->\r\n \"Sum As Fraction Of Parent Row\": sTpl.fractionOf(tpl.sum(), \"row\", usFmtPct)\r\n \"Sum As Fraction Of Parent Column\": sTpl.fractionOf(tpl.sum(), \"col\", usFmtPct)\r\n \"Count As Fraction Of Parent Row\": sTpl.fractionOf(tpl.count(), \"row\", usFmtPct)\r\n \"Count As Fraction Of Parent Column\": sTpl.fractionOf(tpl.count(), \"col\", usFmtPct)\r\n\r\n"]} \ No newline at end of file diff --git a/subtotal.coffee b/subtotal.coffee index 036cb7a..93a8ee6 100644 --- a/subtotal.coffee +++ b/subtotal.coffee @@ -750,8 +750,8 @@ callWithJQuery ($) -> $.pivotUtilities.subtotalAggregatorTemplates = subtotalAggregatorTemplates $.pivotUtilities.subtotal_aggregators = do (tpl = aggregatorTemplates, sTpl = subtotalAggregatorTemplates) -> - "Count As Fraction Of Parent Row": sTpl.fractionOf(tpl.count(), "row", usFmtPct) - "Count As Fraction Of Parent Column": sTpl.fractionOf(tpl.count(), "col", usFmtPct) "Sum As Fraction Of Parent Row": sTpl.fractionOf(tpl.sum(), "row", usFmtPct) "Sum As Fraction Of Parent Column": sTpl.fractionOf(tpl.sum(), "col", usFmtPct) + "Count As Fraction Of Parent Row": sTpl.fractionOf(tpl.count(), "row", usFmtPct) + "Count As Fraction Of Parent Column": sTpl.fractionOf(tpl.count(), "col", usFmtPct)