From 74fd41a509c68cb545e0b0c75f037c4a2e2df344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?RAMELOT=20Lo=C3=AFc?= Date: Thu, 25 Oct 2018 23:59:26 +0200 Subject: [PATCH] Fix issue for total row (#63) * Fix issue for total trow * Update readme with script --- README.md | 2 +- dist/subtotal.js | 3 +-- dist/subtotal.js.map | 2 +- dist/subtotal.min.js | 2 +- dist/subtotal.min.js.map | 2 +- package.json | 8 ++++++-- subtotal.coffee | 2 +- 7 files changed, 12 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 93ab1ad..ccd36d2 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Please refer to [Wiki Pages](https://github.com/nagarajanchinnasamy/subtotal/wik To install the development dependencies, just run `npm install`, which will create a `node_modules` directory with the files required to run the [Gulp](http://gulpjs.com/) build system. -After modifying any of the `.coffee` files at the top of the repo, you can compile/minify the files into the `dist` directory by running `node_modules/gulp/bin/gulp.js` +After modifying any of the `.coffee` files at the top of the repo, you can compile/minify the files into the `dist` directory by running `npm run build` Once that's done, you can point your browser to `tests/index.html` to run the [Jasmine](http://jasmine.github.io/) test suite. You can view the [current test results here](http://nagarajanchinnasamy.com/subtotal/tests). diff --git a/dist/subtotal.js b/dist/subtotal.js index 6502732..d4cdc99 100644 --- a/dist/subtotal.js +++ b/dist/subtotal.js @@ -569,8 +569,7 @@ "data-row": "row" + rh.row, "data-rowcol": "col" + rh.col, "data-rownode": rh.node - }); - getTableEventHandlers(val, rh.key, [], rowAttrs, colAttrs, opts); + }, getTableEventHandlers(val, rh.key, [], rowAttrs, colAttrs, opts)); results.push(tr.appendChild(td)); } return results; diff --git a/dist/subtotal.js.map b/dist/subtotal.js.map index 20b4a81..c0656f3 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,GA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EAAoC,QAApC,CAFxC;QAGA,oCAAA,EAAwC,IAAI,CAAC,UAAL,CAAgB,GAAG,CAAC,KAAJ,CAAA,CAAhB,EAA6B,KAA7B,EAAoC,QAApC,CAHxC;;IADuC,CAAA,CAAH,CAAU,mBAAV,EAAsC,2BAAtC;EAxqB7B,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\", subtotalOf: \"Subtotal of\"\r\n arrowCollapsed: \"\\u25B6\"\r\n arrowExpanded: \"\\u25E2\"\r\n rowSubtotalDisplay:\r\n displayOnTop: true\r\n disableFrom: 99999\r\n collapseAt: 99999\r\n hideOnExpand: false\r\n disableExpandCollapse: false\r\n colSubtotalDisplay:\r\n displayOnTop: true\r\n disableFrom: 99999\r\n collapseAt: 99999\r\n hideOnExpand: false\r\n disableExpandCollapse: false\r\n opts = $.extend true, {}, defaults, opts\r\n\r\n opts.rowSubtotalDisplay.disableFrom = 0 if opts.rowSubtotalDisplay.disableSubtotal\r\n opts.rowSubtotalDisplay.disableFrom = opts.rowSubtotalDisplay.disableAfter+1 if typeof opts.rowSubtotalDisplay.disableAfter isnt 'undefined' and opts.rowSubtotalDisplay.disableAfter isnt null\r\n opts.rowSubtotalDisplay.collapseAt = opts.collapseRowsAt if typeof opts.rowSubtotalDisplay.collapseAt isnt 'undefined' and opts.collapseRowsAt isnt null\r\n\r\n opts.colSubtotalDisplay.disableFrom = 0 if opts.colSubtotalDisplay.disableSubtotal\r\n opts.colSubtotalDisplay.disableFrom = opts.colSubtotalDisplay.disableAfter+1 if typeof opts.colSubtotalDisplay.disableAfter isnt 'undefined' and opts.colSubtotalDisplay.disableAfter isnt null\r\n opts.colSubtotalDisplay.collapseAt = opts.collapseColsAt if typeof opts.colSubtotalDisplay.collapseAt isnt 'undefined' and opts.collapseColsAt isnt null\r\n\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 classRowHide = \"rowhide\"\r\n classRowShow = \"rowshow\"\r\n classColHide = \"colhide\"\r\n classColShow = \"colshow\"\r\n clickStatusExpanded = \"expanded\"\r\n clickStatusCollapsed = \"collapsed\"\r\n classExpanded = \"expanded\"\r\n classCollapsed = \"collapsed\"\r\n classRowExpanded = \"rowexpanded\"\r\n classRowCollapsed = \"rowcollapsed\"\r\n classColExpanded = \"colexpanded\"\r\n classColCollapsed = \"colcollapsed\"\r\n arrowExpanded = opts.arrowExpanded\r\n arrowCollapsed = opts.arrowCollapsed\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) isnt null\r\n\r\n removeClass = (element, className) ->\r\n for name in className.split \" \"\r\n regExp = new RegExp \"(?:^|\\\\s)\" + name + \"(?!\\\\S)\", \"g\"\r\n element.className = element.className.replace regExp, ''\r\n\r\n addClass = (element, className) ->\r\n for name in className.split \" \"\r\n element.className += (\" \" + name) if not hasClass element, name\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 createElement = (elementType, className, textContent, attributes, eventHandlers) ->\r\n e = document.createElement elementType\r\n e.className = className if className?\r\n e.textContent = textContent if textContent?\r\n e.setAttribute attr, val for own attr, val of attributes if attributes?\r\n e.addEventListener event, handler for own event, handler of eventHandlers if eventHandlers?\r\n return e\r\n\r\n setAttributes = (e, attrs) ->\r\n e.setAttribute a, v for own a, v of attrs\r\n\r\n processKeys = (keysArr, className, opts) ->\r\n lastIdx = keysArr[0].length-1\r\n headers = children: []\r\n row = 0\r\n keysArr.reduce(\r\n (val0, k0) => \r\n col = 0\r\n k0.reduce(\r\n (acc, curVal, curIdx, arr) => \r\n if not acc[curVal]\r\n key = k0.slice 0, col+1\r\n acc[curVal] =\r\n row: row\r\n col: col\r\n descendants: 0\r\n children: []\r\n text: curVal\r\n key: key \r\n flatKey: key.join String.fromCharCode(0) \r\n firstLeaf: null \r\n leaves: 0\r\n parent: if col isnt 0 then acc else null\r\n th: createElement \"th\", className, curVal\r\n childrenSpan: 0\r\n acc.children.push curVal\r\n if col > 0 \r\n acc.descendants++\r\n col++\r\n if curIdx == lastIdx\r\n node = headers\r\n for i in [0..lastIdx-1] when lastIdx > 0\r\n node[k0[i]].leaves++\r\n if not node[k0[i]].firstLeaf \r\n node[k0[i]].firstLeaf = acc[curVal]\r\n node = node[k0[i]]\r\n return headers\r\n return acc[curVal]\r\n headers)\r\n row++\r\n return headers\r\n headers)\r\n return headers\r\n\r\n buildAxisHeader = (axisHeaders, col, attrs, opts) ->\r\n ah =\r\n text: attrs[col]\r\n expandedCount: 0\r\n expandables: 0\r\n attrHeaders: []\r\n clickStatus: clickStatusExpanded\r\n onClick: collapseAxis\r\n\r\n arrow = \"#{arrowExpanded} \"\r\n hClass = classExpanded\r\n if col >= opts.collapseAt\r\n arrow = \"#{arrowCollapsed} \"\r\n hClass = classCollapsed\r\n ah.clickStatus = clickStatusCollapsed\r\n ah.onClick = expandAxis\r\n if col == attrs.length-1 or col >= opts.disableFrom or opts.disableExpandCollapse\r\n arrow = \"\"\r\n ah.th = createElement \"th\", \"pvtAxisLabel #{hClass}\", \"#{arrow}#{ah.text}\" \r\n if col < attrs.length-1 and col < opts.disableFrom and not opts.disableExpandCollapse\r\n ah.th.onclick = (event) ->\r\n event = event || window.event\r\n ah.onClick axisHeaders, col, attrs, opts\r\n axisHeaders.ah.push ah\r\n return ah \r\n\r\n buildColAxisHeaders = (thead, rowAttrs, colAttrs, opts) ->\r\n axisHeaders =\r\n collapseAttrHeader: collapseCol\r\n expandAttrHeader: expandCol\r\n ah: []\r\n for attr, col in colAttrs\r\n ah = buildAxisHeader axisHeaders, col, colAttrs, opts.colSubtotalDisplay\r\n ah.tr = createElement \"tr\"\r\n ah.tr.appendChild createElement \"th\", null, null, {colspan: rowAttrs.length, rowspan: colAttrs.length} if col is 0 and rowAttrs.length isnt 0\r\n ah.tr.appendChild ah.th\r\n thead.appendChild ah.tr\r\n return axisHeaders\r\n\r\n buildRowAxisHeaders = (thead, rowAttrs, colAttrs, opts) ->\r\n axisHeaders =\r\n collapseAttrHeader: collapseRow\r\n expandAttrHeader: expandRow\r\n ah: []\r\n tr: createElement \"tr\"\r\n for col in [0..rowAttrs.length-1] \r\n ah = buildAxisHeader axisHeaders, col, rowAttrs, opts.rowSubtotalDisplay\r\n axisHeaders.tr.appendChild ah.th\r\n if colAttrs.length != 0\r\n th = createElement \"th\"\r\n axisHeaders.tr.appendChild th\r\n thead.appendChild axisHeaders.tr\r\n return axisHeaders\r\n\r\n getHeaderText = (h, attrs, opts) ->\r\n arrow = \" #{arrowExpanded} \"\r\n arrow = \"\" if h.col == attrs.length-1 or h.col >= opts.disableFrom or opts.disableExpandCollapse or h.children.length is 0\r\n return \"#{arrow}#{h.text}\"\r\n\r\n buildColHeader = (axisHeaders, attrHeaders, h, rowAttrs, colAttrs, node, opts) ->\r\n # DF Recurse\r\n buildColHeader axisHeaders, attrHeaders, h[chKey], rowAttrs, colAttrs, node, opts for chKey in h.children\r\n # Process\r\n ah = axisHeaders.ah[h.col]\r\n ah.attrHeaders.push h\r\n\r\n h.node = node.counter\r\n h.onClick = collapseCol\r\n\r\n addClass h.th, \"#{classColShow} col#{h.row} colcol#{h.col} #{classColExpanded}\"\r\n h.th.setAttribute \"data-colnode\", h.node\r\n h.th.colSpan = h.childrenSpan if h.children.length isnt 0\r\n h.th.rowSpan = 2 if h.children.length is 0 and rowAttrs.length isnt 0\r\n h.th.textContent = getHeaderText h, colAttrs, opts.colSubtotalDisplay\r\n if h.children.length isnt 0 and h.col < opts.colSubtotalDisplay.disableFrom\r\n ah.expandables++\r\n ah.expandedCount += 1\r\n h.th.colSpan++ if not opts.colSubtotalDisplay.hideOnExpand\r\n if not opts.colSubtotalDisplay.disableExpandCollapse\r\n h.th.onclick = (event) ->\r\n event = event || window.event\r\n h.onClick axisHeaders, h, opts.colSubtotalDisplay \r\n h.sTh = createElement \"th\", \"pvtColLabelFiller #{classColShow} col#{h.row} colcol#{h.col} #{classColExpanded}\"\r\n h.sTh.setAttribute \"data-colnode\", h.node\r\n h.sTh.rowSpan = colAttrs.length-h.col\r\n replaceClass h.sTh, classColShow, classColHide if opts.colSubtotalDisplay.hideOnExpand\r\n h[h.children[0]].tr.appendChild h.sTh\r\n\r\n h.parent?.childrenSpan += h.th.colSpan\r\n\r\n h.clickStatus = clickStatusExpanded\r\n ah.tr.appendChild h.th\r\n h.tr = ah.tr\r\n attrHeaders.push h\r\n node.counter++ \r\n\r\n\r\n buildRowTotalsHeader = (tr, rowAttrs, colAttrs) ->\r\n th = createElement \"th\", \"pvtTotalLabel rowTotal\", opts.localeStrings.totals,\r\n rowspan: if colAttrs.length is 0 then 1 else colAttrs.length + (if rowAttrs.length is 0 then 0 else 1)\r\n tr.appendChild th\r\n\r\n buildRowHeader = (tbody, axisHeaders, attrHeaders, h, rowAttrs, colAttrs, node, opts) ->\r\n # DF Recurse\r\n buildRowHeader tbody, axisHeaders, attrHeaders, h[chKey], rowAttrs, colAttrs, node, opts for chKey in h.children\r\n # Process\r\n ah = axisHeaders.ah[h.col]\r\n ah.attrHeaders.push h\r\n\r\n h.node = node.counter\r\n h.onClick = collapseRow\r\n firstChild = h[h.children[0]] if h.children.length isnt 0\r\n\r\n addClass h.th, \"#{classRowShow} row#{h.row} rowcol#{h.col} #{classRowExpanded}\"\r\n h.th.setAttribute \"data-rownode\", h.node\r\n h.th.colSpan = 2 if h.col is rowAttrs.length-1 and colAttrs.length isnt 0\r\n h.th.rowSpan = h.childrenSpan if h.children.length isnt 0\r\n h.th.textContent = getHeaderText h, rowAttrs, opts.rowSubtotalDisplay\r\n\r\n h.tr = createElement \"tr\", \"row#{h.row}\"\r\n h.tr.appendChild h.th\r\n if h.children.length is 0\r\n tbody.appendChild h.tr\r\n else\r\n tbody.insertBefore h.tr, firstChild.tr\r\n \r\n if h.children.length isnt 0 and h.col < opts.rowSubtotalDisplay.disableFrom\r\n ++ah.expandedCount\r\n ++ah.expandables\r\n if not opts.rowSubtotalDisplay.disableExpandCollapse\r\n h.th.onclick = (event) ->\r\n event = event || window.event\r\n h.onClick axisHeaders, h, opts.rowSubtotalDisplay\r\n\r\n h.sTh = createElement \"th\", \"pvtRowLabelFiller row#{h.row} rowcol#{h.col} #{classRowExpanded} #{classRowShow}\"\r\n replaceClass h.sTh, classRowShow, classRowHide if opts.rowSubtotalDisplay.hideOnExpand\r\n h.sTh.setAttribute \"data-rownode\", h.node\r\n h.sTh.colSpan = rowAttrs.length-(h.col+1) + if colAttrs.length != 0 then 1 else 0 \r\n\r\n if opts.rowSubtotalDisplay.displayOnTop\r\n h.tr.appendChild h.sTh\r\n else\r\n h.th.rowSpan += 1 # if not opts.rowSubtotalDisplay.hideOnExpand\r\n h.sTr = createElement \"tr\", \"row#{h.row}\"\r\n h.sTr.appendChild h.sTh\r\n tbody.appendChild h.sTr\r\n\r\n h.th.rowSpan++ if h.children.length isnt 0\r\n h.parent?.childrenSpan += h.th.rowSpan\r\n\r\n h.clickStatus = clickStatusExpanded\r\n attrHeaders.push h\r\n node.counter++\r\n\r\n getTableEventHandlers = (value, rowKey, colKey, rowAttrs, colAttrs, opts) ->\r\n return if not opts.table?.eventHandlers\r\n eventHandlers = {}\r\n for own event, handler of opts.table.eventHandlers\r\n filters = {}\r\n filters[attr] = colKey[i] for own i, attr of colAttrs when colKey[i]?\r\n filters[attr] = rowKey[i] for own i, attr of rowAttrs when rowKey[i]?\r\n eventHandlers[event] = (e) -> handler(e, value, filters, pivotData)\r\n return eventHandlers\r\n\r\n buildValues = (tbody, colAttrHeaders, rowAttrHeaders, rowAttrs, colAttrs, opts) ->\r\n for rh in rowAttrHeaders when rh.col is rowAttrs.length-1 or (rh.children.length isnt 0 and rh.col < opts.rowSubtotalDisplay.disableFrom)\r\n rCls = \"pvtVal row#{rh.row} rowcol#{rh.col} #{classRowExpanded}\"\r\n if rh.children.length > 0\r\n rCls += \" pvtRowSubtotal\"\r\n rCls += if opts.rowSubtotalDisplay.hideOnExpand then \" #{classRowHide}\" else \" #{classRowShow}\"\r\n else\r\n rCls += \" #{classRowShow}\"\r\n tr = if rh.sTr then rh.sTr else rh.tr\r\n for ch in colAttrHeaders when ch.col is colAttrs.length-1 or (ch.children.length isnt 0 and ch.col < opts.colSubtotalDisplay.disableFrom)\r\n aggregator = tree[rh.flatKey][ch.flatKey] ? {value: (-> null), format: -> \"\"}\r\n val = aggregator.value()\r\n cls = \" #{rCls} col#{ch.row} colcol#{ch.col} #{classColExpanded}\"\r\n if ch.children.length > 0\r\n cls += \" pvtColSubtotal\"\r\n cls += if opts.colSubtotalDisplay.hideOnExpand then \" #{classColHide}\" else \" #{classColShow}\"\r\n else\r\n cls += \" #{classColShow}\"\r\n td = createElement \"td\", cls, aggregator.format(val),\r\n \"data-value\": val\r\n \"data-rownode\": rh.node\r\n \"data-colnode\": ch.node,\r\n getTableEventHandlers val, rh.key, ch.key, rowAttrs, colAttrs, opts\r\n\r\n tr.appendChild td\r\n\r\n # buildRowTotal\r\n totalAggregator = rowTotals[rh.flatKey]\r\n val = totalAggregator.value()\r\n td = createElement \"td\", \"pvtTotal rowTotal #{rCls}\", totalAggregator.format(val),\r\n \"data-value\": val\r\n \"data-row\": \"row#{rh.row}\"\r\n \"data-rowcol\": \"col#{rh.col}\"\r\n \"data-rownode\": rh.node,\r\n getTableEventHandlers val, rh.key, [], rowAttrs, colAttrs, opts\r\n tr.appendChild td\r\n\r\n buildColTotalsHeader = (rowAttrs, colAttrs) ->\r\n tr = createElement \"tr\"\r\n colspan = rowAttrs.length + (if colAttrs.length == 0 then 0 else 1)\r\n th = createElement \"th\", \"pvtTotalLabel colTotal\", opts.localeStrings.totals, {colspan: colspan}\r\n tr.appendChild th\r\n return tr\r\n\r\n buildColTotals = (tr, attrHeaders, rowAttrs, colAttrs, opts) ->\r\n for h in attrHeaders when h.col is colAttrs.length-1 or (h.children.length isnt 0 and h.col < opts.colSubtotalDisplay.disableFrom)\r\n clsNames = \"pvtVal pvtTotal colTotal #{classColExpanded} col#{h.row} colcol#{h.col}\"\r\n if h.children.length isnt 0\r\n clsNames += \" pvtColSubtotal\" \r\n clsNames += if opts.colSubtotalDisplay.hideOnExpand then \" #{classColHide}\" else \" #{classColShow}\"\r\n else\r\n clsNames += \" #{classColShow}\"\r\n totalAggregator = colTotals[h.flatKey]\r\n val = totalAggregator.value()\r\n td = createElement \"td\", clsNames, totalAggregator.format(val),\r\n \"data-value\": val\r\n \"data-for\": \"col#{h.col}\"\r\n \"data-colnode\": \"#{h.node}\",\r\n getTableEventHandlers val, [], h.key, rowAttrs, colAttrs, opts\r\n tr.appendChild td\r\n\r\n buildGrandTotal = (tbody, tr, rowAttrs, colAttrs, opts) ->\r\n totalAggregator = allTotal\r\n val = totalAggregator.value()\r\n td = createElement \"td\", \"pvtGrandTotal\", totalAggregator.format(val),\r\n {\"data-value\": val},\r\n getTableEventHandlers val, [], [], rowAttrs, colAttrs, opts\r\n tr.appendChild td\r\n tbody.appendChild tr\r\n\r\n collapseAxisHeaders = (axisHeaders, col, opts) ->\r\n collapsible = Math.min axisHeaders.ah.length-2, opts.disableFrom-1\r\n return if col > collapsible\r\n for i in [col..collapsible]\r\n ah = axisHeaders.ah[i]\r\n replaceClass ah.th, classExpanded, classCollapsed\r\n ah.th.textContent = \" #{arrowCollapsed} #{ah.text}\"\r\n ah.clickStatus = clickStatusCollapsed\r\n ah.onClick = expandAxis\r\n\r\n adjustAxisHeader = (axisHeaders, col, opts) ->\r\n ah = axisHeaders.ah[col]\r\n if ah.expandedCount is 0\r\n collapseAxisHeaders axisHeaders, col, opts\r\n else if ah.expandedCount is ah.expandables\r\n replaceClass ah.th, classCollapsed, classExpanded\r\n ah.th.textContent = \" #{arrowExpanded} #{ah.text}\"\r\n ah.clickStatus = clickStatusExpanded\r\n ah.onClick = collapseAxis\r\n\r\n hideChildCol = (ch) ->\r\n $(ch.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{ch.node}\\\"], th[data-colnode=\\\"#{ch.node}\\\"]\" \r\n .removeClass classColShow \r\n .addClass classColHide\r\n\r\n collapseHiddenColSubtotal = (h, opts) ->\r\n $(h.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{h.node}\\\"], th[data-colnode=\\\"#{h.node}\\\"]\" \r\n .removeClass classColExpanded\r\n .addClass classColCollapsed\r\n h.th.textContent = \" #{arrowCollapsed} #{h.text}\" if h.children.length isnt 0\r\n h.th.colSpan = 1\r\n \r\n collapseShowColSubtotal = (h, opts) ->\r\n $(h.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{h.node}\\\"], th[data-colnode=\\\"#{h.node}\\\"]\" \r\n .removeClass classColExpanded\r\n .addClass classColCollapsed\r\n .removeClass classColHide\r\n .addClass classColShow\r\n h.th.textContent = \" #{arrowCollapsed} #{h.text}\" if h.children.length isnt 0\r\n h.th.colSpan = 1\r\n\r\n collapseChildCol = (ch, h) ->\r\n collapseChildCol ch[chKey], h for chKey in ch.children when hasClass ch[chKey].th, classColShow\r\n hideChildCol ch\r\n\r\n collapseCol = (axisHeaders, h, opts) ->\r\n colSpan = h.th.colSpan - 1\r\n collapseChildCol h[chKey], h for chKey in h.children when hasClass h[chKey].th, classColShow\r\n if h.col < opts.disableFrom\r\n if hasClass h.th, classColHide\r\n collapseHiddenColSubtotal h, opts\r\n else \r\n collapseShowColSubtotal h, opts\r\n p = h.parent\r\n while p\r\n p.th.colSpan -= colSpan\r\n p = p.parent\r\n h.clickStatus = clickStatusCollapsed\r\n h.onClick = expandCol\r\n axisHeaders.ah[h.col].expandedCount--\r\n adjustAxisHeader axisHeaders, h.col, opts\r\n\r\n showChildCol = (ch) ->\r\n $(ch.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{ch.node}\\\"], th[data-colnode=\\\"#{ch.node}\\\"]\" \r\n .removeClass classColHide\r\n .addClass classColShow\r\n\r\n expandHideColSubtotal = (h) ->\r\n $(h.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{h.node}\\\"], th[data-colnode=\\\"#{h.node}\\\"]\" \r\n .removeClass \"#{classColCollapsed} #{classColShow}\" \r\n .addClass \"#{classColExpanded} #{classColHide}\" \r\n replaceClass h.th, classColHide, classColShow\r\n h.th.textContent = \" #{arrowExpanded} #{h.text}\"\r\n\r\n expandShowColSubtotal = (h) ->\r\n $(h.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{h.node}\\\"], th[data-colnode=\\\"#{h.node}\\\"]\" \r\n .removeClass \"#{classColCollapsed} #{classColHide}\"\r\n .addClass \"#{classColExpanded} #{classColShow}\"\r\n h.th.colSpan++\r\n h.th.textContent = \" #{arrowExpanded} #{h.text}\"\r\n\r\n expandChildCol = (ch, opts) ->\r\n if ch.children.length isnt 0 and opts.hideOnExpand and ch.clickStatus is clickStatusExpanded\r\n replaceClass ch.th, classColHide, classColShow\r\n else\r\n showChildCol ch\r\n if ch.sTh and ch.clickStatus is clickStatusExpanded and opts.hideOnExpand\r\n replaceClass ch.sTh, classColShow, classColHide\r\n expandChildCol ch[chKey], opts for chKey in ch.children if (ch.clickStatus is clickStatusExpanded or ch.col >= opts.disableFrom)\r\n \r\n expandCol = (axisHeaders, h, opts) ->\r\n if h.clickStatus is clickStatusExpanded\r\n adjustAxisHeader axisHeaders, h.col, opts\r\n return\r\n colSpan = 0\r\n for chKey in h.children\r\n ch = h[chKey]\r\n expandChildCol ch, opts\r\n colSpan += ch.th.colSpan\r\n h.th.colSpan = colSpan\r\n\r\n if h.col < opts.disableFrom\r\n if opts.hideOnExpand\r\n expandHideColSubtotal h\r\n --colSpan\r\n else\r\n expandShowColSubtotal h\r\n p = h.parent\r\n while p\r\n p.th.colSpan += colSpan\r\n p = p.parent\r\n h.clickStatus = clickStatusExpanded\r\n h.onClick = collapseCol\r\n axisHeaders.ah[h.col].expandedCount++\r\n adjustAxisHeader axisHeaders, h.col, opts\r\n\r\n hideChildRow = (ch, opts) ->\r\n replaceClass cell, classRowShow, classRowHide for cell in ch.tr.querySelectorAll \"th, td\"\r\n replaceClass cell, classRowShow, classRowHide for cell in ch.sTr.querySelectorAll \"th, td\" if ch.sTr\r\n\r\n collapseShowRowSubtotal = (h, opts) ->\r\n h.th.textContent = \" #{arrowCollapsed} #{h.text}\"\r\n for cell in h.tr.querySelectorAll \"th, td\"\r\n removeClass cell, \"#{classRowExpanded} #{classRowHide}\"\r\n addClass cell, \"#{classRowCollapsed} #{classRowShow}\"\r\n if h.sTr\r\n for cell in h.sTr.querySelectorAll \"th, td\"\r\n removeClass cell, \"#{classRowExpanded} #{classRowHide}\"\r\n addClass cell, \"#{classRowCollapsed} #{classRowShow}\"\r\n\r\n collapseChildRow = (ch, h, opts) ->\r\n collapseChildRow ch[chKey], h, opts for chKey in ch.children\r\n hideChildRow ch, opts\r\n\r\n collapseRow = (axisHeaders, h, opts) ->\r\n collapseChildRow h[chKey], h, opts for chKey in h.children\r\n collapseShowRowSubtotal h, opts\r\n h.clickStatus = clickStatusCollapsed\r\n h.onClick = expandRow\r\n axisHeaders.ah[h.col].expandedCount--\r\n adjustAxisHeader axisHeaders, h.col, opts\r\n\r\n showChildRow = (ch, opts) ->\r\n replaceClass cell, classRowHide, classRowShow for cell in ch.tr.querySelectorAll \"th, td\"\r\n replaceClass cell, classRowHide, classRowShow for cell in ch.sTr.querySelectorAll \"th, td\" if ch.sTr\r\n\r\n expandShowRowSubtotal = (h, opts) ->\r\n h.th.textContent = \" #{arrowExpanded} #{h.text}\"\r\n for cell in h.tr.querySelectorAll \"th, td\"\r\n removeClass cell, \"#{classRowCollapsed} #{classRowHide}\"\r\n addClass cell, \"#{classRowExpanded} #{classRowShow}\"\r\n if h.sTr\r\n for cell in h.sTr.querySelectorAll \"th, td\"\r\n removeClass cell, \"#{classRowCollapsed} #{classRowHide}\"\r\n addClass cell, \"#{classRowExpanded} #{classRowShow}\"\r\n\r\n expandHideRowSubtotal = (h, opts) ->\r\n h.th.textContent = \" #{arrowExpanded} #{h.text}\"\r\n for cell in h.tr.querySelectorAll \"th, td\"\r\n removeClass cell, \"#{classRowCollapsed} #{classRowShow}\"\r\n addClass cell, \"#{classRowExpanded} #{classRowHide}\"\r\n removeClass h.th, \"#{classRowCollapsed} #{classRowHide}\"\r\n addClass cell, \"#{classRowExpanded} #{classRowShow}\"\r\n if h.sTr\r\n for cell in h.sTr.querySelectorAll \"th, td\"\r\n removeClass cell, \"#{classRowCollapsed} #{classRowShow}\"\r\n addClass cell, \"#{classRowExpanded} #{classRowHide}\"\r\n\r\n expandChildRow = (ch, opts) ->\r\n if ch.children.length isnt 0 and opts.hideOnExpand and ch.clickStatus is clickStatusExpanded\r\n replaceClass ch.th, classRowHide, classRowShow\r\n else\r\n showChildRow ch, opts\r\n if ch.sTh and ch.clickStatus is clickStatusExpanded and opts.hideOnExpand\r\n replaceClass ch.sTh, classRowShow, classRowHide\r\n expandChildRow ch[chKey], opts for chKey in ch.children if (ch.clickStatus is clickStatusExpanded or ch.col >= opts.disableFrom)\r\n\r\n expandRow = (axisHeaders, h, opts) ->\r\n if h.clickStatus is clickStatusExpanded\r\n adjustAxisHeader axisHeaders, h.col, opts\r\n return\r\n for chKey in h.children\r\n ch = h[chKey]\r\n expandChildRow ch, opts\r\n if h.children.length isnt 0 \r\n if opts.hideOnExpand\r\n expandHideRowSubtotal h, opts\r\n else\r\n expandShowRowSubtotal h, opts\r\n h.clickStatus = clickStatusExpanded\r\n h.onClick = collapseRow\r\n axisHeaders.ah[h.col].expandedCount++\r\n adjustAxisHeader axisHeaders, h.col, opts\r\n \r\n collapseAxis = (axisHeaders, col, attrs, opts) ->\r\n collapsible = Math.min attrs.length-2, opts.disableFrom-1\r\n return if col > collapsible\r\n axisHeaders.collapseAttrHeader axisHeaders, h, opts for h in axisHeaders.ah[i].attrHeaders when h.clickStatus is clickStatusExpanded and h.children.length isnt 0 for i in [collapsible..col] by -1\r\n\r\n expandAxis = (axisHeaders, col, attrs, opts) ->\r\n ah = axisHeaders.ah[col]\r\n axisHeaders.expandAttrHeader axisHeaders, h, opts for h in axisHeaders.ah[i].attrHeaders for i in [0..col] \r\n # when h.clickStatus is clickStatusCollapsed and h.children.length isnt 0 for i in [0..col] \r\n\r\n main = (rowAttrs, rowKeys, colAttrs, colKeys) ->\r\n rowAttrHeaders = []\r\n colAttrHeaders = []\r\n\r\n colKeyHeaders = processKeys colKeys, \"pvtColLabel\" if colAttrs.length isnt 0 and colKeys.length isnt 0\r\n rowKeyHeaders = processKeys rowKeys, \"pvtRowLabel\" if rowAttrs.length isnt 0 and rowKeys.length isnt 0\r\n\r\n result = createElement \"table\", \"pvtTable\", null, {style: \"display: none;\"}\r\n\r\n thead = createElement \"thead\"\r\n result.appendChild thead\r\n\r\n if colAttrs.length isnt 0\r\n colAxisHeaders = buildColAxisHeaders thead, rowAttrs, colAttrs, opts\r\n node = counter: 0\r\n buildColHeader colAxisHeaders, colAttrHeaders, colKeyHeaders[chKey], rowAttrs, colAttrs, node, opts for chKey in colKeyHeaders.children\r\n buildRowTotalsHeader colAxisHeaders.ah[0].tr, rowAttrs, colAttrs\r\n\r\n tbody = createElement \"tbody\"\r\n result.appendChild tbody\r\n if rowAttrs.length isnt 0\r\n rowAxisHeaders = buildRowAxisHeaders thead, rowAttrs, colAttrs, opts\r\n buildRowTotalsHeader rowAxisHeaders.tr, rowAttrs, colAttrs if colAttrs.length is 0\r\n node = counter: 0\r\n buildRowHeader tbody, rowAxisHeaders, rowAttrHeaders, rowKeyHeaders[chKey], rowAttrs, colAttrs, node, opts for chKey in rowKeyHeaders.children\r\n\r\n buildValues tbody, colAttrHeaders, rowAttrHeaders, rowAttrs, colAttrs, opts\r\n tr = buildColTotalsHeader rowAttrs, colAttrs\r\n buildColTotals tr, colAttrHeaders, rowAttrs, colAttrs, opts if colAttrs.length > 0\r\n buildGrandTotal tbody, tr, rowAttrs, colAttrs, opts\r\n\r\n collapseAxis colAxisHeaders, opts.colSubtotalDisplay.collapseAt, colAttrs, opts.colSubtotalDisplay\r\n collapseAxis rowAxisHeaders, opts.rowSubtotalDisplay.collapseAt, rowAttrs, opts.rowSubtotalDisplay\r\n\r\n result.setAttribute \"data-numrows\", rowKeys.length\r\n result.setAttribute \"data-numcols\", colKeys.length\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 # \r\n # Aggregators\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 +{"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,GAAG,CAAC,IAAJ,CAAS,MAAM,CAAC,YAAP,CAAoB,CAApB,CAAT;UACV,IAAG,CAA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,CAAA,CAAe,CAAC,SAL3B;;UAH+D;QAAV;MAA7C,CAAZ;;IAUJ,CAAC,CAAC,cAAc,CAAC,2BAAjB,GAA+C;WAE/C,CAAC,CAAC,cAAc,CAAC,oBAAjB,GAA2C,CAAA,SAAC,GAAD,EAA4B,IAA5B;aACvC;QAAA,+BAAA,EAAwC,IAAI,CAAC,UAAL,CAAgB,GAAG,CAAC,GAAJ,CAAA,CAAhB,EAA2B,KAA3B,EAAkC,QAAlC,CAAxC;QACA,kCAAA,EAAwC,IAAI,CAAC,UAAL,CAAgB,GAAG,CAAC,GAAJ,CAAA,CAAhB,EAA2B,KAA3B,EAAkC,QAAlC,CADxC;QAEA,iCAAA,EAAwC,IAAI,CAAC,UAAL,CAAgB,GAAG,CAAC,KAAJ,CAAA,CAAhB,EAA6B,KAA7B,EAAoC,QAApC,CAFxC;QAGA,oCAAA,EAAwC,IAAI,CAAC,UAAL,CAAgB,GAAG,CAAC,KAAJ,CAAA,CAAhB,EAA6B,KAA7B,EAAoC,QAApC,CAHxC;;IADuC,CAAA,CAAH,CAAU,mBAAV,EAAsC,2BAAtC;EAxqB7B,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\", subtotalOf: \"Subtotal of\"\r\n arrowCollapsed: \"\\u25B6\"\r\n arrowExpanded: \"\\u25E2\"\r\n rowSubtotalDisplay:\r\n displayOnTop: true\r\n disableFrom: 99999\r\n collapseAt: 99999\r\n hideOnExpand: false\r\n disableExpandCollapse: false\r\n colSubtotalDisplay:\r\n displayOnTop: true\r\n disableFrom: 99999\r\n collapseAt: 99999\r\n hideOnExpand: false\r\n disableExpandCollapse: false\r\n opts = $.extend true, {}, defaults, opts\r\n\r\n opts.rowSubtotalDisplay.disableFrom = 0 if opts.rowSubtotalDisplay.disableSubtotal\r\n opts.rowSubtotalDisplay.disableFrom = opts.rowSubtotalDisplay.disableAfter+1 if typeof opts.rowSubtotalDisplay.disableAfter isnt 'undefined' and opts.rowSubtotalDisplay.disableAfter isnt null\r\n opts.rowSubtotalDisplay.collapseAt = opts.collapseRowsAt if typeof opts.rowSubtotalDisplay.collapseAt isnt 'undefined' and opts.collapseRowsAt isnt null\r\n\r\n opts.colSubtotalDisplay.disableFrom = 0 if opts.colSubtotalDisplay.disableSubtotal\r\n opts.colSubtotalDisplay.disableFrom = opts.colSubtotalDisplay.disableAfter+1 if typeof opts.colSubtotalDisplay.disableAfter isnt 'undefined' and opts.colSubtotalDisplay.disableAfter isnt null\r\n opts.colSubtotalDisplay.collapseAt = opts.collapseColsAt if typeof opts.colSubtotalDisplay.collapseAt isnt 'undefined' and opts.collapseColsAt isnt null\r\n\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 classRowHide = \"rowhide\"\r\n classRowShow = \"rowshow\"\r\n classColHide = \"colhide\"\r\n classColShow = \"colshow\"\r\n clickStatusExpanded = \"expanded\"\r\n clickStatusCollapsed = \"collapsed\"\r\n classExpanded = \"expanded\"\r\n classCollapsed = \"collapsed\"\r\n classRowExpanded = \"rowexpanded\"\r\n classRowCollapsed = \"rowcollapsed\"\r\n classColExpanded = \"colexpanded\"\r\n classColCollapsed = \"colcollapsed\"\r\n arrowExpanded = opts.arrowExpanded\r\n arrowCollapsed = opts.arrowCollapsed\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) isnt null\r\n\r\n removeClass = (element, className) ->\r\n for name in className.split \" \"\r\n regExp = new RegExp \"(?:^|\\\\s)\" + name + \"(?!\\\\S)\", \"g\"\r\n element.className = element.className.replace regExp, ''\r\n\r\n addClass = (element, className) ->\r\n for name in className.split \" \"\r\n element.className += (\" \" + name) if not hasClass element, name\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 createElement = (elementType, className, textContent, attributes, eventHandlers) ->\r\n e = document.createElement elementType\r\n e.className = className if className?\r\n e.textContent = textContent if textContent?\r\n e.setAttribute attr, val for own attr, val of attributes if attributes?\r\n e.addEventListener event, handler for own event, handler of eventHandlers if eventHandlers?\r\n return e\r\n\r\n setAttributes = (e, attrs) ->\r\n e.setAttribute a, v for own a, v of attrs\r\n\r\n processKeys = (keysArr, className, opts) ->\r\n lastIdx = keysArr[0].length-1\r\n headers = children: []\r\n row = 0\r\n keysArr.reduce(\r\n (val0, k0) => \r\n col = 0\r\n k0.reduce(\r\n (acc, curVal, curIdx, arr) => \r\n if not acc[curVal]\r\n key = k0.slice 0, col+1\r\n acc[curVal] =\r\n row: row\r\n col: col\r\n descendants: 0\r\n children: []\r\n text: curVal\r\n key: key \r\n flatKey: key.join String.fromCharCode(0) \r\n firstLeaf: null \r\n leaves: 0\r\n parent: if col isnt 0 then acc else null\r\n th: createElement \"th\", className, curVal\r\n childrenSpan: 0\r\n acc.children.push curVal\r\n if col > 0 \r\n acc.descendants++\r\n col++\r\n if curIdx == lastIdx\r\n node = headers\r\n for i in [0..lastIdx-1] when lastIdx > 0\r\n node[k0[i]].leaves++\r\n if not node[k0[i]].firstLeaf \r\n node[k0[i]].firstLeaf = acc[curVal]\r\n node = node[k0[i]]\r\n return headers\r\n return acc[curVal]\r\n headers)\r\n row++\r\n return headers\r\n headers)\r\n return headers\r\n\r\n buildAxisHeader = (axisHeaders, col, attrs, opts) ->\r\n ah =\r\n text: attrs[col]\r\n expandedCount: 0\r\n expandables: 0\r\n attrHeaders: []\r\n clickStatus: clickStatusExpanded\r\n onClick: collapseAxis\r\n\r\n arrow = \"#{arrowExpanded} \"\r\n hClass = classExpanded\r\n if col >= opts.collapseAt\r\n arrow = \"#{arrowCollapsed} \"\r\n hClass = classCollapsed\r\n ah.clickStatus = clickStatusCollapsed\r\n ah.onClick = expandAxis\r\n if col == attrs.length-1 or col >= opts.disableFrom or opts.disableExpandCollapse\r\n arrow = \"\"\r\n ah.th = createElement \"th\", \"pvtAxisLabel #{hClass}\", \"#{arrow}#{ah.text}\" \r\n if col < attrs.length-1 and col < opts.disableFrom and not opts.disableExpandCollapse\r\n ah.th.onclick = (event) ->\r\n event = event || window.event\r\n ah.onClick axisHeaders, col, attrs, opts\r\n axisHeaders.ah.push ah\r\n return ah \r\n\r\n buildColAxisHeaders = (thead, rowAttrs, colAttrs, opts) ->\r\n axisHeaders =\r\n collapseAttrHeader: collapseCol\r\n expandAttrHeader: expandCol\r\n ah: []\r\n for attr, col in colAttrs\r\n ah = buildAxisHeader axisHeaders, col, colAttrs, opts.colSubtotalDisplay\r\n ah.tr = createElement \"tr\"\r\n ah.tr.appendChild createElement \"th\", null, null, {colspan: rowAttrs.length, rowspan: colAttrs.length} if col is 0 and rowAttrs.length isnt 0\r\n ah.tr.appendChild ah.th\r\n thead.appendChild ah.tr\r\n return axisHeaders\r\n\r\n buildRowAxisHeaders = (thead, rowAttrs, colAttrs, opts) ->\r\n axisHeaders =\r\n collapseAttrHeader: collapseRow\r\n expandAttrHeader: expandRow\r\n ah: []\r\n tr: createElement \"tr\"\r\n for col in [0..rowAttrs.length-1] \r\n ah = buildAxisHeader axisHeaders, col, rowAttrs, opts.rowSubtotalDisplay\r\n axisHeaders.tr.appendChild ah.th\r\n if colAttrs.length != 0\r\n th = createElement \"th\"\r\n axisHeaders.tr.appendChild th\r\n thead.appendChild axisHeaders.tr\r\n return axisHeaders\r\n\r\n getHeaderText = (h, attrs, opts) ->\r\n arrow = \" #{arrowExpanded} \"\r\n arrow = \"\" if h.col == attrs.length-1 or h.col >= opts.disableFrom or opts.disableExpandCollapse or h.children.length is 0\r\n return \"#{arrow}#{h.text}\"\r\n\r\n buildColHeader = (axisHeaders, attrHeaders, h, rowAttrs, colAttrs, node, opts) ->\r\n # DF Recurse\r\n buildColHeader axisHeaders, attrHeaders, h[chKey], rowAttrs, colAttrs, node, opts for chKey in h.children\r\n # Process\r\n ah = axisHeaders.ah[h.col]\r\n ah.attrHeaders.push h\r\n\r\n h.node = node.counter\r\n h.onClick = collapseCol\r\n\r\n addClass h.th, \"#{classColShow} col#{h.row} colcol#{h.col} #{classColExpanded}\"\r\n h.th.setAttribute \"data-colnode\", h.node\r\n h.th.colSpan = h.childrenSpan if h.children.length isnt 0\r\n h.th.rowSpan = 2 if h.children.length is 0 and rowAttrs.length isnt 0\r\n h.th.textContent = getHeaderText h, colAttrs, opts.colSubtotalDisplay\r\n if h.children.length isnt 0 and h.col < opts.colSubtotalDisplay.disableFrom\r\n ah.expandables++\r\n ah.expandedCount += 1\r\n h.th.colSpan++ if not opts.colSubtotalDisplay.hideOnExpand\r\n if not opts.colSubtotalDisplay.disableExpandCollapse\r\n h.th.onclick = (event) ->\r\n event = event || window.event\r\n h.onClick axisHeaders, h, opts.colSubtotalDisplay \r\n h.sTh = createElement \"th\", \"pvtColLabelFiller #{classColShow} col#{h.row} colcol#{h.col} #{classColExpanded}\"\r\n h.sTh.setAttribute \"data-colnode\", h.node\r\n h.sTh.rowSpan = colAttrs.length-h.col\r\n replaceClass h.sTh, classColShow, classColHide if opts.colSubtotalDisplay.hideOnExpand\r\n h[h.children[0]].tr.appendChild h.sTh\r\n\r\n h.parent?.childrenSpan += h.th.colSpan\r\n\r\n h.clickStatus = clickStatusExpanded\r\n ah.tr.appendChild h.th\r\n h.tr = ah.tr\r\n attrHeaders.push h\r\n node.counter++ \r\n\r\n\r\n buildRowTotalsHeader = (tr, rowAttrs, colAttrs) ->\r\n th = createElement \"th\", \"pvtTotalLabel rowTotal\", opts.localeStrings.totals,\r\n rowspan: if colAttrs.length is 0 then 1 else colAttrs.length + (if rowAttrs.length is 0 then 0 else 1)\r\n tr.appendChild th\r\n\r\n buildRowHeader = (tbody, axisHeaders, attrHeaders, h, rowAttrs, colAttrs, node, opts) ->\r\n # DF Recurse\r\n buildRowHeader tbody, axisHeaders, attrHeaders, h[chKey], rowAttrs, colAttrs, node, opts for chKey in h.children\r\n # Process\r\n ah = axisHeaders.ah[h.col]\r\n ah.attrHeaders.push h\r\n\r\n h.node = node.counter\r\n h.onClick = collapseRow\r\n firstChild = h[h.children[0]] if h.children.length isnt 0\r\n\r\n addClass h.th, \"#{classRowShow} row#{h.row} rowcol#{h.col} #{classRowExpanded}\"\r\n h.th.setAttribute \"data-rownode\", h.node\r\n h.th.colSpan = 2 if h.col is rowAttrs.length-1 and colAttrs.length isnt 0\r\n h.th.rowSpan = h.childrenSpan if h.children.length isnt 0\r\n h.th.textContent = getHeaderText h, rowAttrs, opts.rowSubtotalDisplay\r\n\r\n h.tr = createElement \"tr\", \"row#{h.row}\"\r\n h.tr.appendChild h.th\r\n if h.children.length is 0\r\n tbody.appendChild h.tr\r\n else\r\n tbody.insertBefore h.tr, firstChild.tr\r\n \r\n if h.children.length isnt 0 and h.col < opts.rowSubtotalDisplay.disableFrom\r\n ++ah.expandedCount\r\n ++ah.expandables\r\n if not opts.rowSubtotalDisplay.disableExpandCollapse\r\n h.th.onclick = (event) ->\r\n event = event || window.event\r\n h.onClick axisHeaders, h, opts.rowSubtotalDisplay\r\n\r\n h.sTh = createElement \"th\", \"pvtRowLabelFiller row#{h.row} rowcol#{h.col} #{classRowExpanded} #{classRowShow}\"\r\n replaceClass h.sTh, classRowShow, classRowHide if opts.rowSubtotalDisplay.hideOnExpand\r\n h.sTh.setAttribute \"data-rownode\", h.node\r\n h.sTh.colSpan = rowAttrs.length-(h.col+1) + if colAttrs.length != 0 then 1 else 0 \r\n\r\n if opts.rowSubtotalDisplay.displayOnTop\r\n h.tr.appendChild h.sTh\r\n else\r\n h.th.rowSpan += 1 # if not opts.rowSubtotalDisplay.hideOnExpand\r\n h.sTr = createElement \"tr\", \"row#{h.row}\"\r\n h.sTr.appendChild h.sTh\r\n tbody.appendChild h.sTr\r\n\r\n h.th.rowSpan++ if h.children.length isnt 0\r\n h.parent?.childrenSpan += h.th.rowSpan\r\n\r\n h.clickStatus = clickStatusExpanded\r\n attrHeaders.push h\r\n node.counter++\r\n\r\n getTableEventHandlers = (value, rowKey, colKey, rowAttrs, colAttrs, opts) ->\r\n return if not opts.table?.eventHandlers\r\n eventHandlers = {}\r\n for own event, handler of opts.table.eventHandlers\r\n filters = {}\r\n filters[attr] = colKey[i] for own i, attr of colAttrs when colKey[i]?\r\n filters[attr] = rowKey[i] for own i, attr of rowAttrs when rowKey[i]?\r\n eventHandlers[event] = (e) -> handler(e, value, filters, pivotData)\r\n return eventHandlers\r\n\r\n buildValues = (tbody, colAttrHeaders, rowAttrHeaders, rowAttrs, colAttrs, opts) ->\r\n for rh in rowAttrHeaders when rh.col is rowAttrs.length-1 or (rh.children.length isnt 0 and rh.col < opts.rowSubtotalDisplay.disableFrom)\r\n rCls = \"pvtVal row#{rh.row} rowcol#{rh.col} #{classRowExpanded}\"\r\n if rh.children.length > 0\r\n rCls += \" pvtRowSubtotal\"\r\n rCls += if opts.rowSubtotalDisplay.hideOnExpand then \" #{classRowHide}\" else \" #{classRowShow}\"\r\n else\r\n rCls += \" #{classRowShow}\"\r\n tr = if rh.sTr then rh.sTr else rh.tr\r\n for ch in colAttrHeaders when ch.col is colAttrs.length-1 or (ch.children.length isnt 0 and ch.col < opts.colSubtotalDisplay.disableFrom)\r\n aggregator = tree[rh.flatKey][ch.flatKey] ? {value: (-> null), format: -> \"\"}\r\n val = aggregator.value()\r\n cls = \" #{rCls} col#{ch.row} colcol#{ch.col} #{classColExpanded}\"\r\n if ch.children.length > 0\r\n cls += \" pvtColSubtotal\"\r\n cls += if opts.colSubtotalDisplay.hideOnExpand then \" #{classColHide}\" else \" #{classColShow}\"\r\n else\r\n cls += \" #{classColShow}\"\r\n td = createElement \"td\", cls, aggregator.format(val),\r\n \"data-value\": val\r\n \"data-rownode\": rh.node\r\n \"data-colnode\": ch.node,\r\n getTableEventHandlers val, rh.key, ch.key, rowAttrs, colAttrs, opts\r\n\r\n tr.appendChild td\r\n\r\n # buildRowTotal\r\n totalAggregator = rowTotals[rh.flatKey]\r\n val = totalAggregator.value()\r\n td = createElement \"td\", \"pvtTotal rowTotal #{rCls}\", totalAggregator.format(val),\r\n \"data-value\": val\r\n \"data-row\": \"row#{rh.row}\"\r\n \"data-rowcol\": \"col#{rh.col}\"\r\n \"data-rownode\": rh.node,\r\n getTableEventHandlers val, rh.key, [], rowAttrs, colAttrs, opts\r\n tr.appendChild td\r\n\r\n buildColTotalsHeader = (rowAttrs, colAttrs) ->\r\n tr = createElement \"tr\"\r\n colspan = rowAttrs.length + (if colAttrs.length == 0 then 0 else 1)\r\n th = createElement \"th\", \"pvtTotalLabel colTotal\", opts.localeStrings.totals, {colspan: colspan}\r\n tr.appendChild th\r\n return tr\r\n\r\n buildColTotals = (tr, attrHeaders, rowAttrs, colAttrs, opts) ->\r\n for h in attrHeaders when h.col is colAttrs.length-1 or (h.children.length isnt 0 and h.col < opts.colSubtotalDisplay.disableFrom)\r\n clsNames = \"pvtVal pvtTotal colTotal #{classColExpanded} col#{h.row} colcol#{h.col}\"\r\n if h.children.length isnt 0\r\n clsNames += \" pvtColSubtotal\" \r\n clsNames += if opts.colSubtotalDisplay.hideOnExpand then \" #{classColHide}\" else \" #{classColShow}\"\r\n else\r\n clsNames += \" #{classColShow}\"\r\n totalAggregator = colTotals[h.flatKey]\r\n val = totalAggregator.value()\r\n td = createElement \"td\", clsNames, totalAggregator.format(val),\r\n \"data-value\": val\r\n \"data-for\": \"col#{h.col}\"\r\n \"data-colnode\": \"#{h.node}\",\r\n getTableEventHandlers val, [], h.key, rowAttrs, colAttrs, opts\r\n tr.appendChild td\r\n\r\n buildGrandTotal = (tbody, tr, rowAttrs, colAttrs, opts) ->\r\n totalAggregator = allTotal\r\n val = totalAggregator.value()\r\n td = createElement \"td\", \"pvtGrandTotal\", totalAggregator.format(val),\r\n {\"data-value\": val},\r\n getTableEventHandlers val, [], [], rowAttrs, colAttrs, opts\r\n tr.appendChild td\r\n tbody.appendChild tr\r\n\r\n collapseAxisHeaders = (axisHeaders, col, opts) ->\r\n collapsible = Math.min axisHeaders.ah.length-2, opts.disableFrom-1\r\n return if col > collapsible\r\n for i in [col..collapsible]\r\n ah = axisHeaders.ah[i]\r\n replaceClass ah.th, classExpanded, classCollapsed\r\n ah.th.textContent = \" #{arrowCollapsed} #{ah.text}\"\r\n ah.clickStatus = clickStatusCollapsed\r\n ah.onClick = expandAxis\r\n\r\n adjustAxisHeader = (axisHeaders, col, opts) ->\r\n ah = axisHeaders.ah[col]\r\n if ah.expandedCount is 0\r\n collapseAxisHeaders axisHeaders, col, opts\r\n else if ah.expandedCount is ah.expandables\r\n replaceClass ah.th, classCollapsed, classExpanded\r\n ah.th.textContent = \" #{arrowExpanded} #{ah.text}\"\r\n ah.clickStatus = clickStatusExpanded\r\n ah.onClick = collapseAxis\r\n\r\n hideChildCol = (ch) ->\r\n $(ch.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{ch.node}\\\"], th[data-colnode=\\\"#{ch.node}\\\"]\" \r\n .removeClass classColShow \r\n .addClass classColHide\r\n\r\n collapseHiddenColSubtotal = (h, opts) ->\r\n $(h.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{h.node}\\\"], th[data-colnode=\\\"#{h.node}\\\"]\" \r\n .removeClass classColExpanded\r\n .addClass classColCollapsed\r\n h.th.textContent = \" #{arrowCollapsed} #{h.text}\" if h.children.length isnt 0\r\n h.th.colSpan = 1\r\n \r\n collapseShowColSubtotal = (h, opts) ->\r\n $(h.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{h.node}\\\"], th[data-colnode=\\\"#{h.node}\\\"]\" \r\n .removeClass classColExpanded\r\n .addClass classColCollapsed\r\n .removeClass classColHide\r\n .addClass classColShow\r\n h.th.textContent = \" #{arrowCollapsed} #{h.text}\" if h.children.length isnt 0\r\n h.th.colSpan = 1\r\n\r\n collapseChildCol = (ch, h) ->\r\n collapseChildCol ch[chKey], h for chKey in ch.children when hasClass ch[chKey].th, classColShow\r\n hideChildCol ch\r\n\r\n collapseCol = (axisHeaders, h, opts) ->\r\n colSpan = h.th.colSpan - 1\r\n collapseChildCol h[chKey], h for chKey in h.children when hasClass h[chKey].th, classColShow\r\n if h.col < opts.disableFrom\r\n if hasClass h.th, classColHide\r\n collapseHiddenColSubtotal h, opts\r\n else \r\n collapseShowColSubtotal h, opts\r\n p = h.parent\r\n while p\r\n p.th.colSpan -= colSpan\r\n p = p.parent\r\n h.clickStatus = clickStatusCollapsed\r\n h.onClick = expandCol\r\n axisHeaders.ah[h.col].expandedCount--\r\n adjustAxisHeader axisHeaders, h.col, opts\r\n\r\n showChildCol = (ch) ->\r\n $(ch.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{ch.node}\\\"], th[data-colnode=\\\"#{ch.node}\\\"]\" \r\n .removeClass classColHide\r\n .addClass classColShow\r\n\r\n expandHideColSubtotal = (h) ->\r\n $(h.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{h.node}\\\"], th[data-colnode=\\\"#{h.node}\\\"]\" \r\n .removeClass \"#{classColCollapsed} #{classColShow}\" \r\n .addClass \"#{classColExpanded} #{classColHide}\" \r\n replaceClass h.th, classColHide, classColShow\r\n h.th.textContent = \" #{arrowExpanded} #{h.text}\"\r\n\r\n expandShowColSubtotal = (h) ->\r\n $(h.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{h.node}\\\"], th[data-colnode=\\\"#{h.node}\\\"]\" \r\n .removeClass \"#{classColCollapsed} #{classColHide}\"\r\n .addClass \"#{classColExpanded} #{classColShow}\"\r\n h.th.colSpan++\r\n h.th.textContent = \" #{arrowExpanded} #{h.text}\"\r\n\r\n expandChildCol = (ch, opts) ->\r\n if ch.children.length isnt 0 and opts.hideOnExpand and ch.clickStatus is clickStatusExpanded\r\n replaceClass ch.th, classColHide, classColShow\r\n else\r\n showChildCol ch\r\n if ch.sTh and ch.clickStatus is clickStatusExpanded and opts.hideOnExpand\r\n replaceClass ch.sTh, classColShow, classColHide\r\n expandChildCol ch[chKey], opts for chKey in ch.children if (ch.clickStatus is clickStatusExpanded or ch.col >= opts.disableFrom)\r\n \r\n expandCol = (axisHeaders, h, opts) ->\r\n if h.clickStatus is clickStatusExpanded\r\n adjustAxisHeader axisHeaders, h.col, opts\r\n return\r\n colSpan = 0\r\n for chKey in h.children\r\n ch = h[chKey]\r\n expandChildCol ch, opts\r\n colSpan += ch.th.colSpan\r\n h.th.colSpan = colSpan\r\n\r\n if h.col < opts.disableFrom\r\n if opts.hideOnExpand\r\n expandHideColSubtotal h\r\n --colSpan\r\n else\r\n expandShowColSubtotal h\r\n p = h.parent\r\n while p\r\n p.th.colSpan += colSpan\r\n p = p.parent\r\n h.clickStatus = clickStatusExpanded\r\n h.onClick = collapseCol\r\n axisHeaders.ah[h.col].expandedCount++\r\n adjustAxisHeader axisHeaders, h.col, opts\r\n\r\n hideChildRow = (ch, opts) ->\r\n replaceClass cell, classRowShow, classRowHide for cell in ch.tr.querySelectorAll \"th, td\"\r\n replaceClass cell, classRowShow, classRowHide for cell in ch.sTr.querySelectorAll \"th, td\" if ch.sTr\r\n\r\n collapseShowRowSubtotal = (h, opts) ->\r\n h.th.textContent = \" #{arrowCollapsed} #{h.text}\"\r\n for cell in h.tr.querySelectorAll \"th, td\"\r\n removeClass cell, \"#{classRowExpanded} #{classRowHide}\"\r\n addClass cell, \"#{classRowCollapsed} #{classRowShow}\"\r\n if h.sTr\r\n for cell in h.sTr.querySelectorAll \"th, td\"\r\n removeClass cell, \"#{classRowExpanded} #{classRowHide}\"\r\n addClass cell, \"#{classRowCollapsed} #{classRowShow}\"\r\n\r\n collapseChildRow = (ch, h, opts) ->\r\n collapseChildRow ch[chKey], h, opts for chKey in ch.children\r\n hideChildRow ch, opts\r\n\r\n collapseRow = (axisHeaders, h, opts) ->\r\n collapseChildRow h[chKey], h, opts for chKey in h.children\r\n collapseShowRowSubtotal h, opts\r\n h.clickStatus = clickStatusCollapsed\r\n h.onClick = expandRow\r\n axisHeaders.ah[h.col].expandedCount--\r\n adjustAxisHeader axisHeaders, h.col, opts\r\n\r\n showChildRow = (ch, opts) ->\r\n replaceClass cell, classRowHide, classRowShow for cell in ch.tr.querySelectorAll \"th, td\"\r\n replaceClass cell, classRowHide, classRowShow for cell in ch.sTr.querySelectorAll \"th, td\" if ch.sTr\r\n\r\n expandShowRowSubtotal = (h, opts) ->\r\n h.th.textContent = \" #{arrowExpanded} #{h.text}\"\r\n for cell in h.tr.querySelectorAll \"th, td\"\r\n removeClass cell, \"#{classRowCollapsed} #{classRowHide}\"\r\n addClass cell, \"#{classRowExpanded} #{classRowShow}\"\r\n if h.sTr\r\n for cell in h.sTr.querySelectorAll \"th, td\"\r\n removeClass cell, \"#{classRowCollapsed} #{classRowHide}\"\r\n addClass cell, \"#{classRowExpanded} #{classRowShow}\"\r\n\r\n expandHideRowSubtotal = (h, opts) ->\r\n h.th.textContent = \" #{arrowExpanded} #{h.text}\"\r\n for cell in h.tr.querySelectorAll \"th, td\"\r\n removeClass cell, \"#{classRowCollapsed} #{classRowShow}\"\r\n addClass cell, \"#{classRowExpanded} #{classRowHide}\"\r\n removeClass h.th, \"#{classRowCollapsed} #{classRowHide}\"\r\n addClass cell, \"#{classRowExpanded} #{classRowShow}\"\r\n if h.sTr\r\n for cell in h.sTr.querySelectorAll \"th, td\"\r\n removeClass cell, \"#{classRowCollapsed} #{classRowShow}\"\r\n addClass cell, \"#{classRowExpanded} #{classRowHide}\"\r\n\r\n expandChildRow = (ch, opts) ->\r\n if ch.children.length isnt 0 and opts.hideOnExpand and ch.clickStatus is clickStatusExpanded\r\n replaceClass ch.th, classRowHide, classRowShow\r\n else\r\n showChildRow ch, opts\r\n if ch.sTh and ch.clickStatus is clickStatusExpanded and opts.hideOnExpand\r\n replaceClass ch.sTh, classRowShow, classRowHide\r\n expandChildRow ch[chKey], opts for chKey in ch.children if (ch.clickStatus is clickStatusExpanded or ch.col >= opts.disableFrom)\r\n\r\n expandRow = (axisHeaders, h, opts) ->\r\n if h.clickStatus is clickStatusExpanded\r\n adjustAxisHeader axisHeaders, h.col, opts\r\n return\r\n for chKey in h.children\r\n ch = h[chKey]\r\n expandChildRow ch, opts\r\n if h.children.length isnt 0 \r\n if opts.hideOnExpand\r\n expandHideRowSubtotal h, opts\r\n else\r\n expandShowRowSubtotal h, opts\r\n h.clickStatus = clickStatusExpanded\r\n h.onClick = collapseRow\r\n axisHeaders.ah[h.col].expandedCount++\r\n adjustAxisHeader axisHeaders, h.col, opts\r\n \r\n collapseAxis = (axisHeaders, col, attrs, opts) ->\r\n collapsible = Math.min attrs.length-2, opts.disableFrom-1\r\n return if col > collapsible\r\n axisHeaders.collapseAttrHeader axisHeaders, h, opts for h in axisHeaders.ah[i].attrHeaders when h.clickStatus is clickStatusExpanded and h.children.length isnt 0 for i in [collapsible..col] by -1\r\n\r\n expandAxis = (axisHeaders, col, attrs, opts) ->\r\n ah = axisHeaders.ah[col]\r\n axisHeaders.expandAttrHeader axisHeaders, h, opts for h in axisHeaders.ah[i].attrHeaders for i in [0..col] \r\n # when h.clickStatus is clickStatusCollapsed and h.children.length isnt 0 for i in [0..col] \r\n\r\n main = (rowAttrs, rowKeys, colAttrs, colKeys) ->\r\n rowAttrHeaders = []\r\n colAttrHeaders = []\r\n\r\n colKeyHeaders = processKeys colKeys, \"pvtColLabel\" if colAttrs.length isnt 0 and colKeys.length isnt 0\r\n rowKeyHeaders = processKeys rowKeys, \"pvtRowLabel\" if rowAttrs.length isnt 0 and rowKeys.length isnt 0\r\n\r\n result = createElement \"table\", \"pvtTable\", null, {style: \"display: none;\"}\r\n\r\n thead = createElement \"thead\"\r\n result.appendChild thead\r\n\r\n if colAttrs.length isnt 0\r\n colAxisHeaders = buildColAxisHeaders thead, rowAttrs, colAttrs, opts\r\n node = counter: 0\r\n buildColHeader colAxisHeaders, colAttrHeaders, colKeyHeaders[chKey], rowAttrs, colAttrs, node, opts for chKey in colKeyHeaders.children\r\n buildRowTotalsHeader colAxisHeaders.ah[0].tr, rowAttrs, colAttrs\r\n\r\n tbody = createElement \"tbody\"\r\n result.appendChild tbody\r\n if rowAttrs.length isnt 0\r\n rowAxisHeaders = buildRowAxisHeaders thead, rowAttrs, colAttrs, opts\r\n buildRowTotalsHeader rowAxisHeaders.tr, rowAttrs, colAttrs if colAttrs.length is 0\r\n node = counter: 0\r\n buildRowHeader tbody, rowAxisHeaders, rowAttrHeaders, rowKeyHeaders[chKey], rowAttrs, colAttrs, node, opts for chKey in rowKeyHeaders.children\r\n\r\n buildValues tbody, colAttrHeaders, rowAttrHeaders, rowAttrs, colAttrs, opts\r\n tr = buildColTotalsHeader rowAttrs, colAttrs\r\n buildColTotals tr, colAttrHeaders, rowAttrs, colAttrs, opts if colAttrs.length > 0\r\n buildGrandTotal tbody, tr, rowAttrs, colAttrs, opts\r\n\r\n collapseAxis colAxisHeaders, opts.colSubtotalDisplay.collapseAt, colAttrs, opts.colSubtotalDisplay\r\n collapseAxis rowAxisHeaders, opts.rowSubtotalDisplay.collapseAt, rowAttrs, opts.rowSubtotalDisplay\r\n\r\n result.setAttribute \"data-numrows\", rowKeys.length\r\n result.setAttribute \"data-numcols\", colKeys.length\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 # \r\n # Aggregators\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/dist/subtotal.min.js b/dist/subtotal.min.js index 06bb034..2ea4949 100644 --- a/dist/subtotal.min.js +++ b/dist/subtotal.min.js @@ -1,2 +1,2 @@ -(function(){var t,l=function(t,l){function n(){this.constructor=t}for(var o in l)e.call(l,o)&&(t[o]=l[o]);return n.prototype=l.prototype,t.prototype=new n,t.__super__=l.prototype,t},e={}.hasOwnProperty,n=[].slice;(t=function(t){return"object"==typeof exports&&"object"==typeof module?t(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)})(function(t){var o,a,r,i,c;return o=function(t){function e(t,l){e.__super__.constructor.call(this,t,l)}var n;return l(e,t),n=function(t,l,e,n,o){var a,r,i,c,s,d,u;for(s=[],a=!1,c=0,d=n.length;c=h;i=0<=h?++s:--s)o=f.slice(0,i+1),r=o.join(String.fromCharCode(0)),this.tree[r]||(this.tree[r]={}),p.push(function(){var n,i,s;for(s=[],c=n=0,i=u;0<=i?n<=i:n>=i;c=0<=i?++n:--n)e=l.slice(0,c+1),a=e.join(String.fromCharCode(0)),this.tree[r][a]||(this.tree[r][a]=this.aggregator(this,o,e)),s.push(this.tree[r][a].push(t));return s}.call(this));return p}},e}(t.pivotUtilities.PivotData),t.pivotUtilities.SubtotalPivotData=o,a=function(l,n){var o,a,r,i,c,s,d,u,h,p,f,b,g,v,S,C,w,y,x,m,T,A,D,k,O,E,F,H,q,R,L,_,j,K,P,U,N,W,B,I,M,V,G,Q,z,J,X,Y,Z,$,tt,lt,et,nt,ot,at,rt,it,ct,st,dt,ut,ht,pt;return M={table:{clickCallback:null},localeStrings:{totals:"Totals",subtotalOf:"Subtotal of"},arrowCollapsed:"â–¶",arrowExpanded:"â—¢",rowSubtotalDisplay:{displayOnTop:!0,disableFrom:99999,collapseAt:99999,hideOnExpand:!1,disableExpandCollapse:!1},colSubtotalDisplay:{displayOnTop:!0,disableFrom:99999,collapseAt:99999,hideOnExpand:!1,disableExpandCollapse:!1}},n=t.extend(!0,{},M,n),n.rowSubtotalDisplay.disableSubtotal&&(n.rowSubtotalDisplay.disableFrom=0),void 0!==n.rowSubtotalDisplay.disableAfter&&null!==n.rowSubtotalDisplay.disableAfter&&(n.rowSubtotalDisplay.disableFrom=n.rowSubtotalDisplay.disableAfter+1),void 0!==n.rowSubtotalDisplay.collapseAt&&null!==n.collapseRowsAt&&(n.rowSubtotalDisplay.collapseAt=n.collapseRowsAt),n.colSubtotalDisplay.disableSubtotal&&(n.colSubtotalDisplay.disableFrom=0),void 0!==n.colSubtotalDisplay.disableAfter&&null!==n.colSubtotalDisplay.disableAfter&&(n.colSubtotalDisplay.disableFrom=n.colSubtotalDisplay.disableAfter+1),void 0!==n.colSubtotalDisplay.collapseAt&&null!==n.collapseColsAt&&(n.colSubtotalDisplay.collapseAt=n.collapseColsAt),H=l.colAttrs,ct=l.rowAttrs,st=l.getRowKeys(),q=l.getColKeys(),pt=l.tree,dt=l.rowTotals,R=l.colTotals,r=l.allTotal,k="rowhide",O="rowshow",y="colhide",x="colshow",F="expanded",E="collapsed",T="expanded",m="collapsed",D="rowexpanded",A="rowcollapsed",w="colexpanded",C="colcollapsed",c=n.arrowExpanded,i=n.arrowCollapsed,et=function(t,l){var e;return e=new RegExp("(?:^|\\s)"+l+"(?!\\S)","g"),null!==t.className.match(e)},rt=function(t,l){var e,n,o,a,r,i;for(a=l.split(" "),i=[],e=0,n=a.length;e0&&t.descendants++,r++,c===o){for(p=n,d=u=0,f=o-1;0<=f?u<=f:u>=f;d=0<=f?++u:--u)o>0&&(p[e[d]].leaves++,p[e[d]].firstLeaf||(p[e[d]].firstLeaf=t[i]),p=p[e[d]]);return n}return t[i]},n),a++,n}}(),n),n},s=function(t,l,e,n){var o,a,r;return o={text:e[l],expandedCount:0,expandables:0,attrHeaders:[],clickStatus:F,onClick:L},a=c+" ",r=T,l>=n.collapseAt&&(a=i+" ",r=m,o.clickStatus=E,o.onClick=V),(l===e.length-1||l>=n.disableFrom||n.disableExpandCollapse)&&(a=""),o.th=I("th","pvtAxisLabel "+r,""+a+o.text),l=c;r=0<=c?++i:--i)o=s(a,r,l,n.rowSubtotalDisplay),a.tr.appendChild(o.th);return 0!==e.length&&(d=I("th"),a.tr.appendChild(d)),t.appendChild(a.tr),a},tt=function(t,l,e){var n;return n=" "+c+" ",(t.col===l.length-1||t.col>=e.disableFrom||e.disableExpandCollapse||0===t.children.length)&&(n=""),""+n+t.text},u=function(t,l,e,n,a,r,i){var c,s,d,h,p,f;for(p=e.children,d=0,h=p.length;d0?(p+=" pvtRowSubtotal",p+=a.rowSubtotalDisplay.hideOnExpand?" "+k:" "+O):p+=" "+O,C=g.sTr?g.sTr:g.tr,d=0,h=l.length;d0?(c+=" pvtColSubtotal",c+=a.colSubtotalDisplay.hideOnExpand?" "+y:" "+x):c+=" "+x,v=I("td",c,r.format(m),{"data-value":m,"data-rownode":g.node,"data-colnode":i.node},lt(m,g.key,i.key,n,o,a)),C.appendChild(v));S=dt[g.flatKey],m=S.value(),v=I("td","pvtTotal rowTotal "+p,S.format(m),{"data-value":m,"data-row":"row"+g.row,"data-rowcol":"col"+g.col,"data-rownode":g.node}),lt(m,g.key,[],n,o,a),b.push(C.appendChild(v))}return b},p=function(t,l){var e,o,a;return a=I("tr"),e=t.length+(0===l.length?0:1),o=I("th","pvtTotalLabel colTotal",n.localeStrings.totals,{colspan:e}),a.appendChild(o),a},h=function(t,l,e,n,o){var a,r,i,c,s,d,u,h;for(s=[],i=0,c=l.length;io)){for(d=[],a=r=c=l,s=o;c<=s?r<=s:r>=s;a=c<=s?++r:--r)n=t.ah[a],it(n.th,T,m),n.th.textContent=" "+i+" "+n.text,n.clickStatus=E,d.push(n.onClick=V);return d}},a=function(t,l,e){var n;return n=t.ah[l],0===n.expandedCount?_(t,l,e):n.expandedCount===n.expandables?(it(n.th,m,T),n.th.textContent=" "+c+" "+n.text,n.clickStatus=F,n.onClick=L):void 0},nt=function(l){return t(l.th).closest("table.pvtTable").find('tbody tr td[data-colnode="'+l.node+'"], th[data-colnode="'+l.node+'"]').removeClass(x).addClass(y)},U=function(l,e){return t(l.th).closest("table.pvtTable").find('tbody tr td[data-colnode="'+l.node+'"], th[data-colnode="'+l.node+'"]').removeClass(w).addClass(C),0!==l.children.length&&(l.th.textContent=" "+i+" "+l.text),l.th.colSpan=1},W=function(l,e){return t(l.th).closest("table.pvtTable").find('tbody tr td[data-colnode="'+l.node+'"], th[data-colnode="'+l.node+'"]').removeClass(w).addClass(C).removeClass(y).addClass(x),0!==l.children.length&&(l.th.textContent=" "+i+" "+l.text),l.th.colSpan=1},j=function(t,l){var e,n,o,a;for(a=t.children,n=0,o=a.length;n=l.disableFrom){for(a=t.children,r=[],n=0,o=a.length;n=l.disableFrom){for(a=t.children,r=[],n=0,o=a.length;no)){for(s=[],r=i=o,c=l;i>=c;r=i+=-1)s.push(function(){var l,e,o,i;for(o=t.ah[r].attrHeaders,i=[],l=0,e=o.length;l=i;a=0<=i?++r:--r)c.push(function(){var l,e,r,i;for(r=t.ah[a].attrHeaders,i=[],l=0,e=r.length;l0&&h(H,r,t,e,n),f(E,H,t,e,n),L(i,n.colSubtotalDisplay.collapseAt,e,n.colSubtotalDisplay),L(k,n.rowSubtotalDisplay.collapseAt,t,n.rowSubtotalDisplay),A.setAttribute("data-numrows",l.length),A.setAttribute("data-numcols",o.length),A.style.display="",A}(ct,st,H,q)},t.pivotUtilities.subtotal_renderers={"Table With Subtotal":function(t,l){return a(t,l)},"Table With Subtotal Bar Chart":function(l,e){return t(a(l,e)).barchart()},"Table With Subtotal Heatmap":function(l,e){return t(a(l,e)).heatmap("heatmap",e)},"Table With Subtotal Row Heatmap":function(l,e){return t(a(l,e)).heatmap("rowheatmap",e)},"Table With Subtotal Col Heatmap":function(l,e){return t(a(l,e)).heatmap("colheatmap",e)}},c=t.pivotUtilities.numberFormat({digitsAfterDecimal:1,scaler:100,suffix:"%"}),r=t.pivotUtilities.aggregatorTemplates,i={fractionOf:function(t,l,e){return null==l&&(l="row"),null==e&&(e=c),function(){var o;return o=1<=arguments.length?n.call(arguments,0):[],function(n,a,r){return void 0===a&&(a=[]),void 0===r&&(r=[]),{selector:{row:[a.slice(0,-1),[]],col:[[],r.slice(0,-1)]}[l],inner:t.apply(null,o)(n,a,r),push:function(t){return this.inner.push(t)},format:e,value:function(){return this.inner.value()/n.getAggregator.apply(n,this.selector).inner.value()},numInputs:t.apply(null,o)().numInputs}}}}},t.pivotUtilities.subtotalAggregatorTemplates=i,t.pivotUtilities.subtotal_aggregators=function(t,l){return{"Sum As Fraction Of Parent Row":l.fractionOf(t.sum(),"row",c),"Sum As Fraction Of Parent Column":l.fractionOf(t.sum(),"col",c),"Count As Fraction Of Parent Row":l.fractionOf(t.count(),"row",c),"Count As Fraction Of Parent Column":l.fractionOf(t.count(),"col",c)}}(r,i)})}).call(this); +(function(){var t,l=function(t,l){function n(){this.constructor=t}for(var o in l)e.call(l,o)&&(t[o]=l[o]);return n.prototype=l.prototype,t.prototype=new n,t.__super__=l.prototype,t},e={}.hasOwnProperty,n=[].slice;(t=function(t){return"object"==typeof exports&&"object"==typeof module?t(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)})(function(t){var o,a,r,i,c;return o=function(t){function e(t,l){e.__super__.constructor.call(this,t,l)}var n;return l(e,t),n=function(t,l,e,n,o){var a,r,i,c,s,d,u;for(s=[],a=!1,c=0,d=n.length;c=h;i=0<=h?++s:--s)o=f.slice(0,i+1),r=o.join(String.fromCharCode(0)),this.tree[r]||(this.tree[r]={}),p.push(function(){var n,i,s;for(s=[],c=n=0,i=u;0<=i?n<=i:n>=i;c=0<=i?++n:--n)e=l.slice(0,c+1),a=e.join(String.fromCharCode(0)),this.tree[r][a]||(this.tree[r][a]=this.aggregator(this,o,e)),s.push(this.tree[r][a].push(t));return s}.call(this));return p}},e}(t.pivotUtilities.PivotData),t.pivotUtilities.SubtotalPivotData=o,a=function(l,n){var o,a,r,i,c,s,d,u,h,p,f,b,g,v,S,C,w,y,x,m,T,A,D,k,O,E,F,H,q,R,L,_,j,K,P,U,N,W,B,I,M,V,G,Q,z,J,X,Y,Z,$,tt,lt,et,nt,ot,at,rt,it,ct,st,dt,ut,ht,pt;return M={table:{clickCallback:null},localeStrings:{totals:"Totals",subtotalOf:"Subtotal of"},arrowCollapsed:"â–¶",arrowExpanded:"â—¢",rowSubtotalDisplay:{displayOnTop:!0,disableFrom:99999,collapseAt:99999,hideOnExpand:!1,disableExpandCollapse:!1},colSubtotalDisplay:{displayOnTop:!0,disableFrom:99999,collapseAt:99999,hideOnExpand:!1,disableExpandCollapse:!1}},n=t.extend(!0,{},M,n),n.rowSubtotalDisplay.disableSubtotal&&(n.rowSubtotalDisplay.disableFrom=0),void 0!==n.rowSubtotalDisplay.disableAfter&&null!==n.rowSubtotalDisplay.disableAfter&&(n.rowSubtotalDisplay.disableFrom=n.rowSubtotalDisplay.disableAfter+1),void 0!==n.rowSubtotalDisplay.collapseAt&&null!==n.collapseRowsAt&&(n.rowSubtotalDisplay.collapseAt=n.collapseRowsAt),n.colSubtotalDisplay.disableSubtotal&&(n.colSubtotalDisplay.disableFrom=0),void 0!==n.colSubtotalDisplay.disableAfter&&null!==n.colSubtotalDisplay.disableAfter&&(n.colSubtotalDisplay.disableFrom=n.colSubtotalDisplay.disableAfter+1),void 0!==n.colSubtotalDisplay.collapseAt&&null!==n.collapseColsAt&&(n.colSubtotalDisplay.collapseAt=n.collapseColsAt),H=l.colAttrs,ct=l.rowAttrs,st=l.getRowKeys(),q=l.getColKeys(),pt=l.tree,dt=l.rowTotals,R=l.colTotals,r=l.allTotal,k="rowhide",O="rowshow",y="colhide",x="colshow",F="expanded",E="collapsed",T="expanded",m="collapsed",D="rowexpanded",A="rowcollapsed",w="colexpanded",C="colcollapsed",c=n.arrowExpanded,i=n.arrowCollapsed,et=function(t,l){var e;return e=new RegExp("(?:^|\\s)"+l+"(?!\\S)","g"),null!==t.className.match(e)},rt=function(t,l){var e,n,o,a,r,i;for(a=l.split(" "),i=[],e=0,n=a.length;e0&&t.descendants++,r++,c===o){for(p=n,d=u=0,f=o-1;0<=f?u<=f:u>=f;d=0<=f?++u:--u)o>0&&(p[e[d]].leaves++,p[e[d]].firstLeaf||(p[e[d]].firstLeaf=t[i]),p=p[e[d]]);return n}return t[i]},n),a++,n}}(),n),n},s=function(t,l,e,n){var o,a,r;return o={text:e[l],expandedCount:0,expandables:0,attrHeaders:[],clickStatus:F,onClick:L},a=c+" ",r=T,l>=n.collapseAt&&(a=i+" ",r=m,o.clickStatus=E,o.onClick=V),(l===e.length-1||l>=n.disableFrom||n.disableExpandCollapse)&&(a=""),o.th=I("th","pvtAxisLabel "+r,""+a+o.text),l=c;r=0<=c?++i:--i)o=s(a,r,l,n.rowSubtotalDisplay),a.tr.appendChild(o.th);return 0!==e.length&&(d=I("th"),a.tr.appendChild(d)),t.appendChild(a.tr),a},tt=function(t,l,e){var n;return n=" "+c+" ",(t.col===l.length-1||t.col>=e.disableFrom||e.disableExpandCollapse||0===t.children.length)&&(n=""),""+n+t.text},u=function(t,l,e,n,a,r,i){var c,s,d,h,p,f;for(p=e.children,d=0,h=p.length;d0?(p+=" pvtRowSubtotal",p+=a.rowSubtotalDisplay.hideOnExpand?" "+k:" "+O):p+=" "+O,C=g.sTr?g.sTr:g.tr,d=0,h=l.length;d0?(c+=" pvtColSubtotal",c+=a.colSubtotalDisplay.hideOnExpand?" "+y:" "+x):c+=" "+x,v=I("td",c,r.format(m),{"data-value":m,"data-rownode":g.node,"data-colnode":i.node},lt(m,g.key,i.key,n,o,a)),C.appendChild(v));S=dt[g.flatKey],m=S.value(),v=I("td","pvtTotal rowTotal "+p,S.format(m),{"data-value":m,"data-row":"row"+g.row,"data-rowcol":"col"+g.col,"data-rownode":g.node},lt(m,g.key,[],n,o,a)),b.push(C.appendChild(v))}return b},p=function(t,l){var e,o,a;return a=I("tr"),e=t.length+(0===l.length?0:1),o=I("th","pvtTotalLabel colTotal",n.localeStrings.totals,{colspan:e}),a.appendChild(o),a},h=function(t,l,e,n,o){var a,r,i,c,s,d,u,h;for(s=[],i=0,c=l.length;io)){for(d=[],a=r=c=l,s=o;c<=s?r<=s:r>=s;a=c<=s?++r:--r)n=t.ah[a],it(n.th,T,m),n.th.textContent=" "+i+" "+n.text,n.clickStatus=E,d.push(n.onClick=V);return d}},a=function(t,l,e){var n;return n=t.ah[l],0===n.expandedCount?_(t,l,e):n.expandedCount===n.expandables?(it(n.th,m,T),n.th.textContent=" "+c+" "+n.text,n.clickStatus=F,n.onClick=L):void 0},nt=function(l){return t(l.th).closest("table.pvtTable").find('tbody tr td[data-colnode="'+l.node+'"], th[data-colnode="'+l.node+'"]').removeClass(x).addClass(y)},U=function(l,e){return t(l.th).closest("table.pvtTable").find('tbody tr td[data-colnode="'+l.node+'"], th[data-colnode="'+l.node+'"]').removeClass(w).addClass(C),0!==l.children.length&&(l.th.textContent=" "+i+" "+l.text),l.th.colSpan=1},W=function(l,e){return t(l.th).closest("table.pvtTable").find('tbody tr td[data-colnode="'+l.node+'"], th[data-colnode="'+l.node+'"]').removeClass(w).addClass(C).removeClass(y).addClass(x),0!==l.children.length&&(l.th.textContent=" "+i+" "+l.text),l.th.colSpan=1},j=function(t,l){var e,n,o,a;for(a=t.children,n=0,o=a.length;n=l.disableFrom){for(a=t.children,r=[],n=0,o=a.length;n=l.disableFrom){for(a=t.children,r=[],n=0,o=a.length;no)){for(s=[],r=i=o,c=l;i>=c;r=i+=-1)s.push(function(){var l,e,o,i;for(o=t.ah[r].attrHeaders,i=[],l=0,e=o.length;l=i;a=0<=i?++r:--r)c.push(function(){var l,e,r,i;for(r=t.ah[a].attrHeaders,i=[],l=0,e=r.length;l0&&h(H,r,t,e,n),f(E,H,t,e,n),L(i,n.colSubtotalDisplay.collapseAt,e,n.colSubtotalDisplay),L(k,n.rowSubtotalDisplay.collapseAt,t,n.rowSubtotalDisplay),A.setAttribute("data-numrows",l.length),A.setAttribute("data-numcols",o.length),A.style.display="",A}(ct,st,H,q)},t.pivotUtilities.subtotal_renderers={"Table With Subtotal":function(t,l){return a(t,l)},"Table With Subtotal Bar Chart":function(l,e){return t(a(l,e)).barchart()},"Table With Subtotal Heatmap":function(l,e){return t(a(l,e)).heatmap("heatmap",e)},"Table With Subtotal Row Heatmap":function(l,e){return t(a(l,e)).heatmap("rowheatmap",e)},"Table With Subtotal Col Heatmap":function(l,e){return t(a(l,e)).heatmap("colheatmap",e)}},c=t.pivotUtilities.numberFormat({digitsAfterDecimal:1,scaler:100,suffix:"%"}),r=t.pivotUtilities.aggregatorTemplates,i={fractionOf:function(t,l,e){return null==l&&(l="row"),null==e&&(e=c),function(){var o;return o=1<=arguments.length?n.call(arguments,0):[],function(n,a,r){return void 0===a&&(a=[]),void 0===r&&(r=[]),{selector:{row:[a.slice(0,-1),[]],col:[[],r.slice(0,-1)]}[l],inner:t.apply(null,o)(n,a,r),push:function(t){return this.inner.push(t)},format:e,value:function(){return this.inner.value()/n.getAggregator.apply(n,this.selector).inner.value()},numInputs:t.apply(null,o)().numInputs}}}}},t.pivotUtilities.subtotalAggregatorTemplates=i,t.pivotUtilities.subtotal_aggregators=function(t,l){return{"Sum As Fraction Of Parent Row":l.fractionOf(t.sum(),"row",c),"Sum As Fraction Of Parent Column":l.fractionOf(t.sum(),"col",c),"Count As Fraction Of Parent Row":l.fractionOf(t.count(),"row",c),"Count As Fraction Of Parent Column":l.fractionOf(t.count(),"col",c)}}(r,i)})}).call(this); //# sourceMappingURL=subtotal.min.js.map diff --git a/dist/subtotal.min.js.map b/dist/subtotal.min.js.map index 93baeba..1880c9f 100644 --- a/dist/subtotal.min.js.map +++ b/dist/subtotal.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["subtotal.coffee"],"names":["callWithJQuery","extend","child","parent","ctor","this","constructor","key","hasProp","call","prototype","__super__","pivotModule","exports","module","require","define","amd","jQuery","$","SubtotalPivotData","SubtotalRenderer","aggregatorTemplates","subtotalAggregatorTemplates","usFmtPct","superClass","input","opts","processKey","record","totals","keys","attrs","getAggregator","addKey","attr","flatKey","k","len","ref","length","push","join","String","fromCharCode","slice","processRecord","colKey","fColKey","fRowKey","flatColKey","flatRowKey","i","j","m","n","results","rowKey","allTotal","rowTotals","rowKeys","rowAttrs","_this","aggregator","colTotals","colKeys","colAttrs","tree","results1","l","ref1","pivotUtilities","PivotData","pivotData","addClass","adjustAxisHeader","arrowCollapsed","arrowExpanded","buildAxisHeader","buildColAxisHeaders","buildColHeader","buildColTotals","buildColTotalsHeader","buildGrandTotal","buildRowAxisHeaders","buildRowHeader","buildRowTotalsHeader","buildValues","classColCollapsed","classColExpanded","classColHide","classColShow","classCollapsed","classExpanded","classRowCollapsed","classRowExpanded","classRowHide","classRowShow","clickStatusCollapsed","clickStatusExpanded","collapseAxis","collapseAxisHeaders","collapseChildCol","collapseChildRow","collapseCol","collapseHiddenColSubtotal","collapseRow","collapseShowColSubtotal","collapseShowRowSubtotal","createElement","defaults","expandAxis","expandChildCol","expandChildRow","expandCol","expandHideColSubtotal","expandHideRowSubtotal","expandRow","expandShowColSubtotal","expandShowRowSubtotal","getHeaderText","getTableEventHandlers","hasClass","hideChildCol","hideChildRow","processKeys","removeClass","replaceClass","showChildCol","showChildRow","table","clickCallback","localeStrings","subtotalOf","rowSubtotalDisplay","displayOnTop","disableFrom","collapseAt","hideOnExpand","disableExpandCollapse","colSubtotalDisplay","disableSubtotal","disableAfter","collapseRowsAt","collapseColsAt","getRowKeys","getColKeys","element","className","regExp","RegExp","match","name","split","replace","replaceClassName","byClassName","elementType","textContent","attributes","eventHandlers","e","event","handler","val","document","setAttribute","addEventListener","a","v","keysArr","headers","lastIdx","row","children","reduce","val0","k0","col","acc","curVal","curIdx","arr","node","descendants","text","firstLeaf","leaves","th","childrenSpan","axisHeaders","ah","arrow","hClass","expandedCount","expandables","attrHeaders","clickStatus","onClick","onclick","window","thead","collapseAttrHeader","expandAttrHeader","tr","appendChild","colspan","rowspan","h","chKey","counter","colSpan","rowSpan","sTh","tbody","firstChild","insertBefore","sTr","value","filters","colAttrHeaders","rowAttrHeaders","ch","cls","len1","rCls","rh","td","totalAggregator","format","data-value","data-rownode","data-colnode","data-row","data-rowcol","clsNames","data-for","collapsible","Math","min","closest","find","p","cell","querySelectorAll","ref2","colAxisHeaders","colKeyHeaders","result","rowAxisHeaders","rowKeyHeaders","style","display","subtotal_renderers","Table With Subtotal","pvtData","Table With Subtotal Bar Chart","barchart","Table With Subtotal Heatmap","heatmap","Table With Subtotal Row Heatmap","Table With Subtotal Col Heatmap","numberFormat","digitsAfterDecimal","scaler","suffix","fractionOf","wrapped","type","formatter","x","arguments","data","selector","inner","apply","numInputs","subtotal_aggregators","tpl","sTpl","Sum As Fraction Of Parent Row","sum","Sum As Fraction Of Parent Column","Count As Fraction Of Parent Row","count","Count As Fraction Of Parent Column"],"mappings":"CAAA,WAAA,GAAAA,GAAAC,EAAA,SAAAC,EAAAC,GAAA,QAAAC,KAAAC,KAAAC,YAAAJ,EAAA,IAAA,GAAAK,KAAAJ,GAAAK,EAAAC,KAAAN,EAAAI,KAAAL,EAAAK,GAAAJ,EAAAI,GAAA,OAAAH,GAAAM,UAAAP,EAAAO,UAAAR,EAAAQ,UAAA,GAAAN,GAAAF,EAAAS,UAAAR,EAAAO,UAAAR,mCAAAF,EAAiB,SAACY,GACd,MAAqB,gBAAXC,UAAyC,gBAAVC,QACrCF,EAAYG,QAAQ,WACC,kBAAVC,SAAyBA,OAAOC,IAC3CD,QAAQ,UAAWJ,GAGnBA,EAAYM,UAEL,SAACC,GAEZ,GAAAC,GAAAC,EAAAC,EAAAC,EAAAC,QAAMJ,GAAA,SAAAK,GACW,QAAAL,GAACM,EAAOC,GACjBP,EAAAT,UAAAL,YAAAG,KAAAJ,KAAMqB,EAAOC,GADjB,GAAAC,iBAGAA,EAAa,SAACC,EAAQC,EAAQC,EAAMC,EAAOC,GACvC,GAAAC,GAAAC,EAAAC,EAAAC,EAAA9B,EAAA+B,EAAAC,CAEA,KAFAhC,KACA2B,GAAS,EACTG,EAAA,EAAAC,EAAAN,EAAAQ,OAAAH,EAAAC,EAAAD,WACI9B,EAAIkC,KAAJ,OAAAF,EAAAV,EAAAM,IAAAI,EAAwB,QACxBH,EAAU7B,EAAImC,KAAKC,OAAOC,aAAa,IAChCd,EAAOM,KACVN,EAAOM,GAAWH,EAAc1B,EAAIsC,SACpCX,GAAS,GACbJ,EAAOM,GAASK,KAAKZ,EAEzB,OADiBK,IAAjBH,EAAKU,KAAKlC,GACHA,eAEXuC,cAAe,SAACjB,GACZ,GAAAkB,GAAAC,EAAAC,EAAAC,EAAAC,EAAAC,E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8BA,EAE/CJ,EAAEoD,eAAe8M,qBAA0B,SAACC,EAA2BC,UACnEC,gCAAwCD,EAAKb,WAAWY,EAAIG,MAAO,MAAOjQ,GAC1EkQ,mCAAwCH,EAAKb,WAAWY,EAAIG,MAAO,MAAOjQ,GAC1EmQ,kCAAwCJ,EAAKb,WAAWY,EAAIM,QAAS,MAAOpQ,GAC5EqQ,qCAAwCN,EAAKb,WAAWY,EAAIM,QAAS,MAAOpQ,KAJ9BF,EAA4BC","file":"subtotal.min.js","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\", subtotalOf: \"Subtotal of\"\r\n arrowCollapsed: \"\\u25B6\"\r\n arrowExpanded: \"\\u25E2\"\r\n rowSubtotalDisplay:\r\n displayOnTop: true\r\n disableFrom: 99999\r\n collapseAt: 99999\r\n hideOnExpand: false\r\n disableExpandCollapse: false\r\n colSubtotalDisplay:\r\n displayOnTop: true\r\n disableFrom: 99999\r\n collapseAt: 99999\r\n hideOnExpand: false\r\n disableExpandCollapse: false\r\n opts = $.extend true, {}, defaults, opts\r\n\r\n opts.rowSubtotalDisplay.disableFrom = 0 if opts.rowSubtotalDisplay.disableSubtotal\r\n opts.rowSubtotalDisplay.disableFrom = opts.rowSubtotalDisplay.disableAfter+1 if typeof opts.rowSubtotalDisplay.disableAfter isnt 'undefined' and opts.rowSubtotalDisplay.disableAfter isnt null\r\n opts.rowSubtotalDisplay.collapseAt = opts.collapseRowsAt if typeof opts.rowSubtotalDisplay.collapseAt isnt 'undefined' and opts.collapseRowsAt isnt null\r\n\r\n opts.colSubtotalDisplay.disableFrom = 0 if opts.colSubtotalDisplay.disableSubtotal\r\n opts.colSubtotalDisplay.disableFrom = opts.colSubtotalDisplay.disableAfter+1 if typeof opts.colSubtotalDisplay.disableAfter isnt 'undefined' and opts.colSubtotalDisplay.disableAfter isnt null\r\n opts.colSubtotalDisplay.collapseAt = opts.collapseColsAt if typeof opts.colSubtotalDisplay.collapseAt isnt 'undefined' and opts.collapseColsAt isnt null\r\n\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 classRowHide = \"rowhide\"\r\n classRowShow = \"rowshow\"\r\n classColHide = \"colhide\"\r\n classColShow = \"colshow\"\r\n clickStatusExpanded = \"expanded\"\r\n clickStatusCollapsed = \"collapsed\"\r\n classExpanded = \"expanded\"\r\n classCollapsed = \"collapsed\"\r\n classRowExpanded = \"rowexpanded\"\r\n classRowCollapsed = \"rowcollapsed\"\r\n classColExpanded = \"colexpanded\"\r\n classColCollapsed = \"colcollapsed\"\r\n arrowExpanded = opts.arrowExpanded\r\n arrowCollapsed = opts.arrowCollapsed\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) isnt null\r\n\r\n removeClass = (element, className) ->\r\n for name in className.split \" \"\r\n regExp = new RegExp \"(?:^|\\\\s)\" + name + \"(?!\\\\S)\", \"g\"\r\n element.className = element.className.replace regExp, ''\r\n\r\n addClass = (element, className) ->\r\n for name in className.split \" \"\r\n element.className += (\" \" + name) if not hasClass element, name\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 createElement = (elementType, className, textContent, attributes, eventHandlers) ->\r\n e = document.createElement elementType\r\n e.className = className if className?\r\n e.textContent = textContent if textContent?\r\n e.setAttribute attr, val for own attr, val of attributes if attributes?\r\n e.addEventListener event, handler for own event, handler of eventHandlers if eventHandlers?\r\n return e\r\n\r\n setAttributes = (e, attrs) ->\r\n e.setAttribute a, v for own a, v of attrs\r\n\r\n processKeys = (keysArr, className, opts) ->\r\n lastIdx = keysArr[0].length-1\r\n headers = children: []\r\n row = 0\r\n keysArr.reduce(\r\n (val0, k0) => \r\n col = 0\r\n k0.reduce(\r\n (acc, curVal, curIdx, arr) => \r\n if not acc[curVal]\r\n key = k0.slice 0, col+1\r\n acc[curVal] =\r\n row: row\r\n col: col\r\n descendants: 0\r\n children: []\r\n text: curVal\r\n key: key \r\n flatKey: key.join String.fromCharCode(0) \r\n firstLeaf: null \r\n leaves: 0\r\n parent: if col isnt 0 then acc else null\r\n th: createElement \"th\", className, curVal\r\n childrenSpan: 0\r\n acc.children.push curVal\r\n if col > 0 \r\n acc.descendants++\r\n col++\r\n if curIdx == lastIdx\r\n node = headers\r\n for i in [0..lastIdx-1] when lastIdx > 0\r\n node[k0[i]].leaves++\r\n if not node[k0[i]].firstLeaf \r\n node[k0[i]].firstLeaf = acc[curVal]\r\n node = node[k0[i]]\r\n return headers\r\n return acc[curVal]\r\n headers)\r\n row++\r\n return headers\r\n headers)\r\n return headers\r\n\r\n buildAxisHeader = (axisHeaders, col, attrs, opts) ->\r\n ah =\r\n text: attrs[col]\r\n expandedCount: 0\r\n expandables: 0\r\n attrHeaders: []\r\n clickStatus: clickStatusExpanded\r\n onClick: collapseAxis\r\n\r\n arrow = \"#{arrowExpanded} \"\r\n hClass = classExpanded\r\n if col >= opts.collapseAt\r\n arrow = \"#{arrowCollapsed} \"\r\n hClass = classCollapsed\r\n ah.clickStatus = clickStatusCollapsed\r\n ah.onClick = expandAxis\r\n if col == attrs.length-1 or col >= opts.disableFrom or opts.disableExpandCollapse\r\n arrow = \"\"\r\n ah.th = createElement \"th\", \"pvtAxisLabel #{hClass}\", \"#{arrow}#{ah.text}\" \r\n if col < attrs.length-1 and col < opts.disableFrom and not opts.disableExpandCollapse\r\n ah.th.onclick = (event) ->\r\n event = event || window.event\r\n ah.onClick axisHeaders, col, attrs, opts\r\n axisHeaders.ah.push ah\r\n return ah \r\n\r\n buildColAxisHeaders = (thead, rowAttrs, colAttrs, opts) ->\r\n axisHeaders =\r\n collapseAttrHeader: collapseCol\r\n expandAttrHeader: expandCol\r\n ah: []\r\n for attr, col in colAttrs\r\n ah = buildAxisHeader axisHeaders, col, colAttrs, opts.colSubtotalDisplay\r\n ah.tr = createElement \"tr\"\r\n ah.tr.appendChild createElement \"th\", null, null, {colspan: rowAttrs.length, rowspan: colAttrs.length} if col is 0 and rowAttrs.length isnt 0\r\n ah.tr.appendChild ah.th\r\n thead.appendChild ah.tr\r\n return axisHeaders\r\n\r\n buildRowAxisHeaders = (thead, rowAttrs, colAttrs, opts) ->\r\n axisHeaders =\r\n collapseAttrHeader: collapseRow\r\n expandAttrHeader: expandRow\r\n ah: []\r\n tr: createElement \"tr\"\r\n for col in [0..rowAttrs.length-1] \r\n ah = buildAxisHeader axisHeaders, col, rowAttrs, opts.rowSubtotalDisplay\r\n axisHeaders.tr.appendChild ah.th\r\n if colAttrs.length != 0\r\n th = createElement \"th\"\r\n axisHeaders.tr.appendChild th\r\n thead.appendChild axisHeaders.tr\r\n return axisHeaders\r\n\r\n getHeaderText = (h, attrs, opts) ->\r\n arrow = \" #{arrowExpanded} \"\r\n arrow = \"\" if h.col == attrs.length-1 or h.col >= opts.disableFrom or opts.disableExpandCollapse or h.children.length is 0\r\n return \"#{arrow}#{h.text}\"\r\n\r\n buildColHeader = (axisHeaders, attrHeaders, h, rowAttrs, colAttrs, node, opts) ->\r\n # DF Recurse\r\n buildColHeader axisHeaders, attrHeaders, h[chKey], rowAttrs, colAttrs, node, opts for chKey in h.children\r\n # Process\r\n ah = axisHeaders.ah[h.col]\r\n ah.attrHeaders.push h\r\n\r\n h.node = node.counter\r\n h.onClick = collapseCol\r\n\r\n addClass h.th, \"#{classColShow} col#{h.row} colcol#{h.col} #{classColExpanded}\"\r\n h.th.setAttribute \"data-colnode\", h.node\r\n h.th.colSpan = h.childrenSpan if h.children.length isnt 0\r\n h.th.rowSpan = 2 if h.children.length is 0 and rowAttrs.length isnt 0\r\n h.th.textContent = getHeaderText h, colAttrs, opts.colSubtotalDisplay\r\n if h.children.length isnt 0 and h.col < opts.colSubtotalDisplay.disableFrom\r\n ah.expandables++\r\n ah.expandedCount += 1\r\n h.th.colSpan++ if not opts.colSubtotalDisplay.hideOnExpand\r\n if not opts.colSubtotalDisplay.disableExpandCollapse\r\n h.th.onclick = (event) ->\r\n event = event || window.event\r\n h.onClick axisHeaders, h, opts.colSubtotalDisplay \r\n h.sTh = createElement \"th\", \"pvtColLabelFiller #{classColShow} col#{h.row} colcol#{h.col} #{classColExpanded}\"\r\n h.sTh.setAttribute \"data-colnode\", h.node\r\n h.sTh.rowSpan = colAttrs.length-h.col\r\n replaceClass h.sTh, classColShow, classColHide if opts.colSubtotalDisplay.hideOnExpand\r\n h[h.children[0]].tr.appendChild h.sTh\r\n\r\n h.parent?.childrenSpan += h.th.colSpan\r\n\r\n h.clickStatus = clickStatusExpanded\r\n ah.tr.appendChild h.th\r\n h.tr = ah.tr\r\n attrHeaders.push h\r\n node.counter++ \r\n\r\n\r\n buildRowTotalsHeader = (tr, rowAttrs, colAttrs) ->\r\n th = createElement \"th\", \"pvtTotalLabel rowTotal\", opts.localeStrings.totals,\r\n rowspan: if colAttrs.length is 0 then 1 else colAttrs.length + (if rowAttrs.length is 0 then 0 else 1)\r\n tr.appendChild th\r\n\r\n buildRowHeader = (tbody, axisHeaders, attrHeaders, h, rowAttrs, colAttrs, node, opts) ->\r\n # DF Recurse\r\n buildRowHeader tbody, axisHeaders, attrHeaders, h[chKey], rowAttrs, colAttrs, node, opts for chKey in h.children\r\n # Process\r\n ah = axisHeaders.ah[h.col]\r\n ah.attrHeaders.push h\r\n\r\n h.node = node.counter\r\n h.onClick = collapseRow\r\n firstChild = h[h.children[0]] if h.children.length isnt 0\r\n\r\n addClass h.th, \"#{classRowShow} row#{h.row} rowcol#{h.col} #{classRowExpanded}\"\r\n h.th.setAttribute \"data-rownode\", h.node\r\n h.th.colSpan = 2 if h.col is rowAttrs.length-1 and colAttrs.length isnt 0\r\n h.th.rowSpan = h.childrenSpan if h.children.length isnt 0\r\n h.th.textContent = getHeaderText h, rowAttrs, opts.rowSubtotalDisplay\r\n\r\n h.tr = createElement \"tr\", \"row#{h.row}\"\r\n h.tr.appendChild h.th\r\n if h.children.length is 0\r\n tbody.appendChild h.tr\r\n else\r\n tbody.insertBefore h.tr, firstChild.tr\r\n \r\n if h.children.length isnt 0 and h.col < opts.rowSubtotalDisplay.disableFrom\r\n ++ah.expandedCount\r\n ++ah.expandables\r\n if not opts.rowSubtotalDisplay.disableExpandCollapse\r\n h.th.onclick = (event) ->\r\n event = event || window.event\r\n h.onClick axisHeaders, h, opts.rowSubtotalDisplay\r\n\r\n h.sTh = createElement \"th\", \"pvtRowLabelFiller row#{h.row} rowcol#{h.col} #{classRowExpanded} #{classRowShow}\"\r\n replaceClass h.sTh, classRowShow, classRowHide if opts.rowSubtotalDisplay.hideOnExpand\r\n h.sTh.setAttribute \"data-rownode\", h.node\r\n h.sTh.colSpan = rowAttrs.length-(h.col+1) + if colAttrs.length != 0 then 1 else 0 \r\n\r\n if opts.rowSubtotalDisplay.displayOnTop\r\n h.tr.appendChild h.sTh\r\n else\r\n h.th.rowSpan += 1 # if not opts.rowSubtotalDisplay.hideOnExpand\r\n h.sTr = createElement \"tr\", \"row#{h.row}\"\r\n h.sTr.appendChild h.sTh\r\n tbody.appendChild h.sTr\r\n\r\n h.th.rowSpan++ if h.children.length isnt 0\r\n h.parent?.childrenSpan += h.th.rowSpan\r\n\r\n h.clickStatus = clickStatusExpanded\r\n attrHeaders.push h\r\n node.counter++\r\n\r\n getTableEventHandlers = (value, rowKey, colKey, rowAttrs, colAttrs, opts) ->\r\n return if not opts.table?.eventHandlers\r\n eventHandlers = {}\r\n for own event, handler of opts.table.eventHandlers\r\n filters = {}\r\n filters[attr] = colKey[i] for own i, attr of colAttrs when colKey[i]?\r\n filters[attr] = rowKey[i] for own i, attr of rowAttrs when rowKey[i]?\r\n eventHandlers[event] = (e) -> handler(e, value, filters, pivotData)\r\n return eventHandlers\r\n\r\n buildValues = (tbody, colAttrHeaders, rowAttrHeaders, rowAttrs, colAttrs, opts) ->\r\n for rh in rowAttrHeaders when rh.col is rowAttrs.length-1 or (rh.children.length isnt 0 and rh.col < opts.rowSubtotalDisplay.disableFrom)\r\n rCls = \"pvtVal row#{rh.row} rowcol#{rh.col} #{classRowExpanded}\"\r\n if rh.children.length > 0\r\n rCls += \" pvtRowSubtotal\"\r\n rCls += if opts.rowSubtotalDisplay.hideOnExpand then \" #{classRowHide}\" else \" #{classRowShow}\"\r\n else\r\n rCls += \" #{classRowShow}\"\r\n tr = if rh.sTr then rh.sTr else rh.tr\r\n for ch in colAttrHeaders when ch.col is colAttrs.length-1 or (ch.children.length isnt 0 and ch.col < opts.colSubtotalDisplay.disableFrom)\r\n aggregator = tree[rh.flatKey][ch.flatKey] ? {value: (-> null), format: -> \"\"}\r\n val = aggregator.value()\r\n cls = \" #{rCls} col#{ch.row} colcol#{ch.col} #{classColExpanded}\"\r\n if ch.children.length > 0\r\n cls += \" pvtColSubtotal\"\r\n cls += if opts.colSubtotalDisplay.hideOnExpand then \" #{classColHide}\" else \" #{classColShow}\"\r\n else\r\n cls += \" #{classColShow}\"\r\n td = createElement \"td\", cls, aggregator.format(val),\r\n \"data-value\": val\r\n \"data-rownode\": rh.node\r\n \"data-colnode\": ch.node,\r\n getTableEventHandlers val, rh.key, ch.key, rowAttrs, colAttrs, opts\r\n\r\n tr.appendChild td\r\n\r\n # buildRowTotal\r\n totalAggregator = rowTotals[rh.flatKey]\r\n val = totalAggregator.value()\r\n td = createElement \"td\", \"pvtTotal rowTotal #{rCls}\", totalAggregator.format(val),\r\n \"data-value\": val\r\n \"data-row\": \"row#{rh.row}\"\r\n \"data-rowcol\": \"col#{rh.col}\"\r\n \"data-rownode\": rh.node,\r\n getTableEventHandlers val, rh.key, [], rowAttrs, colAttrs, opts\r\n tr.appendChild td\r\n\r\n buildColTotalsHeader = (rowAttrs, colAttrs) ->\r\n tr = createElement \"tr\"\r\n colspan = rowAttrs.length + (if colAttrs.length == 0 then 0 else 1)\r\n th = createElement \"th\", \"pvtTotalLabel colTotal\", opts.localeStrings.totals, {colspan: colspan}\r\n tr.appendChild th\r\n return tr\r\n\r\n buildColTotals = (tr, attrHeaders, rowAttrs, colAttrs, opts) ->\r\n for h in attrHeaders when h.col is colAttrs.length-1 or (h.children.length isnt 0 and h.col < opts.colSubtotalDisplay.disableFrom)\r\n clsNames = \"pvtVal pvtTotal colTotal #{classColExpanded} col#{h.row} colcol#{h.col}\"\r\n if h.children.length isnt 0\r\n clsNames += \" pvtColSubtotal\" \r\n clsNames += if opts.colSubtotalDisplay.hideOnExpand then \" #{classColHide}\" else \" #{classColShow}\"\r\n else\r\n clsNames += \" #{classColShow}\"\r\n totalAggregator = colTotals[h.flatKey]\r\n val = totalAggregator.value()\r\n td = createElement \"td\", clsNames, totalAggregator.format(val),\r\n \"data-value\": val\r\n \"data-for\": \"col#{h.col}\"\r\n \"data-colnode\": \"#{h.node}\",\r\n getTableEventHandlers val, [], h.key, rowAttrs, colAttrs, opts\r\n tr.appendChild td\r\n\r\n buildGrandTotal = (tbody, tr, rowAttrs, colAttrs, opts) ->\r\n totalAggregator = allTotal\r\n val = totalAggregator.value()\r\n td = createElement \"td\", \"pvtGrandTotal\", totalAggregator.format(val),\r\n {\"data-value\": val},\r\n getTableEventHandlers val, [], [], rowAttrs, colAttrs, opts\r\n tr.appendChild td\r\n tbody.appendChild tr\r\n\r\n collapseAxisHeaders = (axisHeaders, col, opts) ->\r\n collapsible = Math.min axisHeaders.ah.length-2, opts.disableFrom-1\r\n return if col > collapsible\r\n for i in [col..collapsible]\r\n ah = axisHeaders.ah[i]\r\n replaceClass ah.th, classExpanded, classCollapsed\r\n ah.th.textContent = \" #{arrowCollapsed} #{ah.text}\"\r\n ah.clickStatus = clickStatusCollapsed\r\n ah.onClick = expandAxis\r\n\r\n adjustAxisHeader = (axisHeaders, col, opts) ->\r\n ah = axisHeaders.ah[col]\r\n if ah.expandedCount is 0\r\n collapseAxisHeaders axisHeaders, col, opts\r\n else if ah.expandedCount is ah.expandables\r\n replaceClass ah.th, classCollapsed, classExpanded\r\n ah.th.textContent = \" #{arrowExpanded} #{ah.text}\"\r\n ah.clickStatus = clickStatusExpanded\r\n ah.onClick = collapseAxis\r\n\r\n hideChildCol = (ch) ->\r\n $(ch.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{ch.node}\\\"], th[data-colnode=\\\"#{ch.node}\\\"]\" \r\n .removeClass classColShow \r\n .addClass classColHide\r\n\r\n collapseHiddenColSubtotal = (h, opts) ->\r\n $(h.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{h.node}\\\"], th[data-colnode=\\\"#{h.node}\\\"]\" \r\n .removeClass classColExpanded\r\n .addClass classColCollapsed\r\n h.th.textContent = \" #{arrowCollapsed} #{h.text}\" if h.children.length isnt 0\r\n h.th.colSpan = 1\r\n \r\n collapseShowColSubtotal = (h, opts) ->\r\n $(h.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{h.node}\\\"], th[data-colnode=\\\"#{h.node}\\\"]\" \r\n .removeClass classColExpanded\r\n .addClass classColCollapsed\r\n .removeClass classColHide\r\n .addClass classColShow\r\n h.th.textContent = \" #{arrowCollapsed} #{h.text}\" if h.children.length isnt 0\r\n h.th.colSpan = 1\r\n\r\n collapseChildCol = (ch, h) ->\r\n collapseChildCol ch[chKey], h for chKey in ch.children when hasClass ch[chKey].th, classColShow\r\n hideChildCol ch\r\n\r\n collapseCol = (axisHeaders, h, opts) ->\r\n colSpan = h.th.colSpan - 1\r\n collapseChildCol h[chKey], h for chKey in h.children when hasClass h[chKey].th, classColShow\r\n if h.col < opts.disableFrom\r\n if hasClass h.th, classColHide\r\n collapseHiddenColSubtotal h, opts\r\n else \r\n collapseShowColSubtotal h, opts\r\n p = h.parent\r\n while p\r\n p.th.colSpan -= colSpan\r\n p = p.parent\r\n h.clickStatus = clickStatusCollapsed\r\n h.onClick = expandCol\r\n axisHeaders.ah[h.col].expandedCount--\r\n adjustAxisHeader axisHeaders, h.col, opts\r\n\r\n showChildCol = (ch) ->\r\n $(ch.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{ch.node}\\\"], th[data-colnode=\\\"#{ch.node}\\\"]\" \r\n .removeClass classColHide\r\n .addClass classColShow\r\n\r\n expandHideColSubtotal = (h) ->\r\n $(h.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{h.node}\\\"], th[data-colnode=\\\"#{h.node}\\\"]\" \r\n .removeClass \"#{classColCollapsed} #{classColShow}\" \r\n .addClass \"#{classColExpanded} #{classColHide}\" \r\n replaceClass h.th, classColHide, classColShow\r\n h.th.textContent = \" #{arrowExpanded} #{h.text}\"\r\n\r\n expandShowColSubtotal = (h) ->\r\n $(h.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{h.node}\\\"], th[data-colnode=\\\"#{h.node}\\\"]\" \r\n .removeClass \"#{classColCollapsed} #{classColHide}\"\r\n .addClass \"#{classColExpanded} #{classColShow}\"\r\n h.th.colSpan++\r\n h.th.textContent = \" #{arrowExpanded} #{h.text}\"\r\n\r\n expandChildCol = (ch, opts) ->\r\n if ch.children.length isnt 0 and opts.hideOnExpand and ch.clickStatus is clickStatusExpanded\r\n replaceClass ch.th, classColHide, classColShow\r\n else\r\n showChildCol ch\r\n if ch.sTh and ch.clickStatus is clickStatusExpanded and opts.hideOnExpand\r\n replaceClass ch.sTh, classColShow, classColHide\r\n expandChildCol ch[chKey], opts for chKey in ch.children if (ch.clickStatus is clickStatusExpanded or ch.col >= opts.disableFrom)\r\n \r\n expandCol = (axisHeaders, h, opts) ->\r\n if h.clickStatus is clickStatusExpanded\r\n adjustAxisHeader axisHeaders, h.col, opts\r\n return\r\n colSpan = 0\r\n for chKey in h.children\r\n ch = h[chKey]\r\n expandChildCol ch, opts\r\n colSpan += ch.th.colSpan\r\n h.th.colSpan = colSpan\r\n\r\n if h.col < opts.disableFrom\r\n if opts.hideOnExpand\r\n expandHideColSubtotal h\r\n --colSpan\r\n else\r\n expandShowColSubtotal h\r\n p = h.parent\r\n while p\r\n p.th.colSpan += colSpan\r\n p = p.parent\r\n h.clickStatus = clickStatusExpanded\r\n h.onClick = collapseCol\r\n axisHeaders.ah[h.col].expandedCount++\r\n adjustAxisHeader axisHeaders, h.col, opts\r\n\r\n hideChildRow = (ch, opts) ->\r\n replaceClass cell, classRowShow, classRowHide for cell in ch.tr.querySelectorAll \"th, td\"\r\n replaceClass cell, classRowShow, classRowHide for cell in ch.sTr.querySelectorAll \"th, td\" if ch.sTr\r\n\r\n collapseShowRowSubtotal = (h, opts) ->\r\n h.th.textContent = \" #{arrowCollapsed} #{h.text}\"\r\n for cell in h.tr.querySelectorAll \"th, td\"\r\n removeClass cell, \"#{classRowExpanded} #{classRowHide}\"\r\n addClass cell, \"#{classRowCollapsed} #{classRowShow}\"\r\n if h.sTr\r\n for cell in h.sTr.querySelectorAll \"th, td\"\r\n removeClass cell, \"#{classRowExpanded} #{classRowHide}\"\r\n addClass cell, \"#{classRowCollapsed} #{classRowShow}\"\r\n\r\n collapseChildRow = (ch, h, opts) ->\r\n collapseChildRow ch[chKey], h, opts for chKey in ch.children\r\n hideChildRow ch, opts\r\n\r\n collapseRow = (axisHeaders, h, opts) ->\r\n collapseChildRow h[chKey], h, opts for chKey in h.children\r\n collapseShowRowSubtotal h, opts\r\n h.clickStatus = clickStatusCollapsed\r\n h.onClick = expandRow\r\n axisHeaders.ah[h.col].expandedCount--\r\n adjustAxisHeader axisHeaders, h.col, opts\r\n\r\n showChildRow = (ch, opts) ->\r\n replaceClass cell, classRowHide, classRowShow for cell in ch.tr.querySelectorAll \"th, td\"\r\n replaceClass cell, classRowHide, classRowShow for cell in ch.sTr.querySelectorAll \"th, td\" if ch.sTr\r\n\r\n expandShowRowSubtotal = (h, opts) ->\r\n h.th.textContent = \" #{arrowExpanded} #{h.text}\"\r\n for cell in h.tr.querySelectorAll \"th, td\"\r\n removeClass cell, \"#{classRowCollapsed} #{classRowHide}\"\r\n addClass cell, \"#{classRowExpanded} #{classRowShow}\"\r\n if h.sTr\r\n for cell in h.sTr.querySelectorAll \"th, td\"\r\n removeClass cell, \"#{classRowCollapsed} #{classRowHide}\"\r\n addClass cell, \"#{classRowExpanded} #{classRowShow}\"\r\n\r\n expandHideRowSubtotal = (h, opts) ->\r\n h.th.textContent = \" #{arrowExpanded} #{h.text}\"\r\n for cell in h.tr.querySelectorAll \"th, td\"\r\n removeClass cell, \"#{classRowCollapsed} #{classRowShow}\"\r\n addClass cell, \"#{classRowExpanded} #{classRowHide}\"\r\n removeClass h.th, \"#{classRowCollapsed} #{classRowHide}\"\r\n addClass cell, \"#{classRowExpanded} #{classRowShow}\"\r\n if h.sTr\r\n for cell in h.sTr.querySelectorAll \"th, td\"\r\n removeClass cell, \"#{classRowCollapsed} #{classRowShow}\"\r\n addClass cell, \"#{classRowExpanded} #{classRowHide}\"\r\n\r\n expandChildRow = (ch, opts) ->\r\n if ch.children.length isnt 0 and opts.hideOnExpand and ch.clickStatus is clickStatusExpanded\r\n replaceClass ch.th, classRowHide, classRowShow\r\n else\r\n showChildRow ch, opts\r\n if ch.sTh and ch.clickStatus is clickStatusExpanded and opts.hideOnExpand\r\n replaceClass ch.sTh, classRowShow, classRowHide\r\n expandChildRow ch[chKey], opts for chKey in ch.children if (ch.clickStatus is clickStatusExpanded or ch.col >= opts.disableFrom)\r\n\r\n expandRow = (axisHeaders, h, opts) ->\r\n if h.clickStatus is clickStatusExpanded\r\n adjustAxisHeader axisHeaders, h.col, opts\r\n return\r\n for chKey in h.children\r\n ch = h[chKey]\r\n expandChildRow ch, opts\r\n if h.children.length isnt 0 \r\n if opts.hideOnExpand\r\n expandHideRowSubtotal h, opts\r\n else\r\n expandShowRowSubtotal h, opts\r\n h.clickStatus = clickStatusExpanded\r\n h.onClick = collapseRow\r\n axisHeaders.ah[h.col].expandedCount++\r\n adjustAxisHeader axisHeaders, h.col, opts\r\n \r\n collapseAxis = (axisHeaders, col, attrs, opts) ->\r\n collapsible = Math.min attrs.length-2, opts.disableFrom-1\r\n return if col > collapsible\r\n axisHeaders.collapseAttrHeader axisHeaders, h, opts for h in axisHeaders.ah[i].attrHeaders when h.clickStatus is clickStatusExpanded and h.children.length isnt 0 for i in [collapsible..col] by -1\r\n\r\n expandAxis = (axisHeaders, col, attrs, opts) ->\r\n ah = axisHeaders.ah[col]\r\n axisHeaders.expandAttrHeader axisHeaders, h, opts for h in axisHeaders.ah[i].attrHeaders for i in [0..col] \r\n # when h.clickStatus is clickStatusCollapsed and h.children.length isnt 0 for i in [0..col] \r\n\r\n main = (rowAttrs, rowKeys, colAttrs, colKeys) ->\r\n rowAttrHeaders = []\r\n colAttrHeaders = []\r\n\r\n colKeyHeaders = processKeys colKeys, \"pvtColLabel\" if colAttrs.length isnt 0 and colKeys.length isnt 0\r\n rowKeyHeaders = processKeys rowKeys, \"pvtRowLabel\" if rowAttrs.length isnt 0 and rowKeys.length isnt 0\r\n\r\n result = createElement \"table\", \"pvtTable\", null, {style: \"display: none;\"}\r\n\r\n thead = createElement \"thead\"\r\n result.appendChild thead\r\n\r\n if colAttrs.length isnt 0\r\n colAxisHeaders = buildColAxisHeaders thead, rowAttrs, colAttrs, opts\r\n node = counter: 0\r\n buildColHeader colAxisHeaders, colAttrHeaders, colKeyHeaders[chKey], rowAttrs, colAttrs, node, opts for chKey in colKeyHeaders.children\r\n buildRowTotalsHeader colAxisHeaders.ah[0].tr, rowAttrs, colAttrs\r\n\r\n tbody = createElement \"tbody\"\r\n result.appendChild tbody\r\n if rowAttrs.length isnt 0\r\n rowAxisHeaders = buildRowAxisHeaders thead, rowAttrs, colAttrs, opts\r\n buildRowTotalsHeader rowAxisHeaders.tr, rowAttrs, colAttrs if colAttrs.length is 0\r\n node = counter: 0\r\n buildRowHeader tbody, rowAxisHeaders, rowAttrHeaders, rowKeyHeaders[chKey], rowAttrs, colAttrs, node, opts for chKey in rowKeyHeaders.children\r\n\r\n buildValues tbody, colAttrHeaders, rowAttrHeaders, rowAttrs, colAttrs, opts\r\n tr = buildColTotalsHeader rowAttrs, colAttrs\r\n buildColTotals tr, colAttrHeaders, rowAttrs, colAttrs, opts if colAttrs.length > 0\r\n buildGrandTotal tbody, tr, rowAttrs, colAttrs, opts\r\n\r\n collapseAxis colAxisHeaders, opts.colSubtotalDisplay.collapseAt, colAttrs, opts.colSubtotalDisplay\r\n collapseAxis rowAxisHeaders, opts.rowSubtotalDisplay.collapseAt, rowAttrs, opts.rowSubtotalDisplay\r\n\r\n result.setAttribute \"data-numrows\", rowKeys.length\r\n result.setAttribute \"data-numcols\", colKeys.length\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 # \r\n # Aggregators\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 +{"version":3,"sources":["subtotal.coffee"],"names":["callWithJQuery","extend","child","parent","ctor","this","constructor","key","hasProp","call","prototype","__super__","pivotModule","exports","module","require","define","amd","jQuery","$","SubtotalPivotData","SubtotalRenderer","aggregatorTemplates","subtotalAggregatorTemplates","usFmtPct","superClass","input","opts","processKey","record","totals","keys","attrs","getAggregator","addKey","attr","flatKey","k","len","ref","length","push","join","String","fromCharCode","slice","processRecord","colKey","fColKey","fRowKey","flatColKey","flatRowKey","i","j","m","n","results","rowKey","allTotal","rowTotals","rowKeys","rowAttrs","_this","aggregator","colTotals","colKeys","colAttrs","tree","results1","l","ref1","pivotUtilities","PivotData","pivotData","addClass","adjustAxisHeader","arrowCollapsed","arrowExpanded","buildAxisHeader","buildColAxisHeaders","buildColHeader","buildColTotals","buildColTotalsHeader","buildGrandTotal","buildRowAxisHeaders","buildRowHeader","buildRowTotalsHeader","buildValues","classColCollapsed","classColExpanded","classColHide","classColShow","classCollapsed","classExpanded","classRowCollapsed","classRowExpanded","classRowHide","classRowShow","clickStatusCollapsed","clickStatusExpanded","collapseAxis","collapseAxisHeaders","collapseChildCol","collapseChildRow","collapseCol","collapseHiddenColSubtotal","collapseRow","collapseShowColSubtotal","collapseShowRowSubtotal","createElement","defaults","expandAxis","expandChildCol","expandChildRow","expandCol","expandHideColSubtotal","expandHideRowSubtotal","expandRow","expandShowColSubtotal","expandShowRowSubtotal","getHeaderText","getTableEventHandlers","hasClass","hideChildCol","hideChildRow","processKeys","removeClass","replaceClass","showChildCol","showChildRow","table","clickCallback","localeStrings","subtotalOf","rowSubtotalDisplay","displayOnTop","disableFrom","collapseAt","hideOnExpand","disableExpandCollapse","colSubtotalDisplay","disableSubtotal","disableAfter","collapseRowsAt","collapseColsAt","getRowKeys","getColKeys","element","className","regExp","RegExp","match","name","split","replace","replaceClassName","byClassName","elementType","textContent","attributes","eventHandlers","e","event","handler","val","document","setAttribute","addEventListener","a","v","keysArr","headers","lastIdx","row","children","reduce","val0","k0","col","acc","curVal","curIdx","arr","node","descendants","text","firstLeaf","leaves","th","childrenSpan","axisHeaders","ah","arrow","hClass","expandedCount","expandables","attrHeaders","clickStatus","onClick","onclick","window","thead","collapseAttrHeader","expandAttrHeader","tr","appendChild","colspan","rowspan","h","chKey","counter","colSpan","rowSpan","sTh","tbody","firstChild","insertBefore","sTr","value","filters","colAttrHeaders","rowAttrHeaders","ch","cls","len1","rCls","rh","td","totalAggregator","format","data-value","data-rownode","data-colnode","data-row","data-rowcol","clsNames","data-for","collapsible","Math","min","closest","find","p","cell","querySelectorAll","ref2","colAxisHeaders","colKeyHeaders","result","rowAxisHeaders","rowKeyHeaders","style","display","subtotal_renderers","Table With Subtotal","pvtData","Table With Subtotal Bar Chart","barchart","Table With Subtotal Heatmap","heatmap","Table With Subtotal Row Heatmap","Table With Subtotal Col Heatmap","numberFormat","digitsAfterDecimal","scaler","suffix","fractionOf","wrapped","type","formatter","x","arguments","data","selector","inner","apply","numInputs","subtotal_aggregators","tpl","sTpl","Sum As Fraction Of Parent Row","sum","Sum As Fraction Of Parent Column","Count As Fraction Of Parent Row","count","Count As Fraction Of Parent Column"],"mappings":"CAAA,WAAA,GAA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,MAAOjQ,GAC1EmQ,kCAAwCJ,EAAKb,WAAWY,EAAIM,QAAS,MAAOpQ,GAC5EqQ,qCAAwCN,EAAKb,WAAWY,EAAIM,QAAS,MAAOpQ,KAJ9BF,EAA4BC","file":"subtotal.min.js","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\", subtotalOf: \"Subtotal of\"\r\n arrowCollapsed: \"\\u25B6\"\r\n arrowExpanded: \"\\u25E2\"\r\n rowSubtotalDisplay:\r\n displayOnTop: true\r\n disableFrom: 99999\r\n collapseAt: 99999\r\n hideOnExpand: false\r\n disableExpandCollapse: false\r\n colSubtotalDisplay:\r\n displayOnTop: true\r\n disableFrom: 99999\r\n collapseAt: 99999\r\n hideOnExpand: false\r\n disableExpandCollapse: false\r\n opts = $.extend true, {}, defaults, opts\r\n\r\n opts.rowSubtotalDisplay.disableFrom = 0 if opts.rowSubtotalDisplay.disableSubtotal\r\n opts.rowSubtotalDisplay.disableFrom = opts.rowSubtotalDisplay.disableAfter+1 if typeof opts.rowSubtotalDisplay.disableAfter isnt 'undefined' and opts.rowSubtotalDisplay.disableAfter isnt null\r\n opts.rowSubtotalDisplay.collapseAt = opts.collapseRowsAt if typeof opts.rowSubtotalDisplay.collapseAt isnt 'undefined' and opts.collapseRowsAt isnt null\r\n\r\n opts.colSubtotalDisplay.disableFrom = 0 if opts.colSubtotalDisplay.disableSubtotal\r\n opts.colSubtotalDisplay.disableFrom = opts.colSubtotalDisplay.disableAfter+1 if typeof opts.colSubtotalDisplay.disableAfter isnt 'undefined' and opts.colSubtotalDisplay.disableAfter isnt null\r\n opts.colSubtotalDisplay.collapseAt = opts.collapseColsAt if typeof opts.colSubtotalDisplay.collapseAt isnt 'undefined' and opts.collapseColsAt isnt null\r\n\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 classRowHide = \"rowhide\"\r\n classRowShow = \"rowshow\"\r\n classColHide = \"colhide\"\r\n classColShow = \"colshow\"\r\n clickStatusExpanded = \"expanded\"\r\n clickStatusCollapsed = \"collapsed\"\r\n classExpanded = \"expanded\"\r\n classCollapsed = \"collapsed\"\r\n classRowExpanded = \"rowexpanded\"\r\n classRowCollapsed = \"rowcollapsed\"\r\n classColExpanded = \"colexpanded\"\r\n classColCollapsed = \"colcollapsed\"\r\n arrowExpanded = opts.arrowExpanded\r\n arrowCollapsed = opts.arrowCollapsed\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) isnt null\r\n\r\n removeClass = (element, className) ->\r\n for name in className.split \" \"\r\n regExp = new RegExp \"(?:^|\\\\s)\" + name + \"(?!\\\\S)\", \"g\"\r\n element.className = element.className.replace regExp, ''\r\n\r\n addClass = (element, className) ->\r\n for name in className.split \" \"\r\n element.className += (\" \" + name) if not hasClass element, name\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 createElement = (elementType, className, textContent, attributes, eventHandlers) ->\r\n e = document.createElement elementType\r\n e.className = className if className?\r\n e.textContent = textContent if textContent?\r\n e.setAttribute attr, val for own attr, val of attributes if attributes?\r\n e.addEventListener event, handler for own event, handler of eventHandlers if eventHandlers?\r\n return e\r\n\r\n setAttributes = (e, attrs) ->\r\n e.setAttribute a, v for own a, v of attrs\r\n\r\n processKeys = (keysArr, className, opts) ->\r\n lastIdx = keysArr[0].length-1\r\n headers = children: []\r\n row = 0\r\n keysArr.reduce(\r\n (val0, k0) => \r\n col = 0\r\n k0.reduce(\r\n (acc, curVal, curIdx, arr) => \r\n if not acc[curVal]\r\n key = k0.slice 0, col+1\r\n acc[curVal] =\r\n row: row\r\n col: col\r\n descendants: 0\r\n children: []\r\n text: curVal\r\n key: key \r\n flatKey: key.join String.fromCharCode(0) \r\n firstLeaf: null \r\n leaves: 0\r\n parent: if col isnt 0 then acc else null\r\n th: createElement \"th\", className, curVal\r\n childrenSpan: 0\r\n acc.children.push curVal\r\n if col > 0 \r\n acc.descendants++\r\n col++\r\n if curIdx == lastIdx\r\n node = headers\r\n for i in [0..lastIdx-1] when lastIdx > 0\r\n node[k0[i]].leaves++\r\n if not node[k0[i]].firstLeaf \r\n node[k0[i]].firstLeaf = acc[curVal]\r\n node = node[k0[i]]\r\n return headers\r\n return acc[curVal]\r\n headers)\r\n row++\r\n return headers\r\n headers)\r\n return headers\r\n\r\n buildAxisHeader = (axisHeaders, col, attrs, opts) ->\r\n ah =\r\n text: attrs[col]\r\n expandedCount: 0\r\n expandables: 0\r\n attrHeaders: []\r\n clickStatus: clickStatusExpanded\r\n onClick: collapseAxis\r\n\r\n arrow = \"#{arrowExpanded} \"\r\n hClass = classExpanded\r\n if col >= opts.collapseAt\r\n arrow = \"#{arrowCollapsed} \"\r\n hClass = classCollapsed\r\n ah.clickStatus = clickStatusCollapsed\r\n ah.onClick = expandAxis\r\n if col == attrs.length-1 or col >= opts.disableFrom or opts.disableExpandCollapse\r\n arrow = \"\"\r\n ah.th = createElement \"th\", \"pvtAxisLabel #{hClass}\", \"#{arrow}#{ah.text}\" \r\n if col < attrs.length-1 and col < opts.disableFrom and not opts.disableExpandCollapse\r\n ah.th.onclick = (event) ->\r\n event = event || window.event\r\n ah.onClick axisHeaders, col, attrs, opts\r\n axisHeaders.ah.push ah\r\n return ah \r\n\r\n buildColAxisHeaders = (thead, rowAttrs, colAttrs, opts) ->\r\n axisHeaders =\r\n collapseAttrHeader: collapseCol\r\n expandAttrHeader: expandCol\r\n ah: []\r\n for attr, col in colAttrs\r\n ah = buildAxisHeader axisHeaders, col, colAttrs, opts.colSubtotalDisplay\r\n ah.tr = createElement \"tr\"\r\n ah.tr.appendChild createElement \"th\", null, null, {colspan: rowAttrs.length, rowspan: colAttrs.length} if col is 0 and rowAttrs.length isnt 0\r\n ah.tr.appendChild ah.th\r\n thead.appendChild ah.tr\r\n return axisHeaders\r\n\r\n buildRowAxisHeaders = (thead, rowAttrs, colAttrs, opts) ->\r\n axisHeaders =\r\n collapseAttrHeader: collapseRow\r\n expandAttrHeader: expandRow\r\n ah: []\r\n tr: createElement \"tr\"\r\n for col in [0..rowAttrs.length-1] \r\n ah = buildAxisHeader axisHeaders, col, rowAttrs, opts.rowSubtotalDisplay\r\n axisHeaders.tr.appendChild ah.th\r\n if colAttrs.length != 0\r\n th = createElement \"th\"\r\n axisHeaders.tr.appendChild th\r\n thead.appendChild axisHeaders.tr\r\n return axisHeaders\r\n\r\n getHeaderText = (h, attrs, opts) ->\r\n arrow = \" #{arrowExpanded} \"\r\n arrow = \"\" if h.col == attrs.length-1 or h.col >= opts.disableFrom or opts.disableExpandCollapse or h.children.length is 0\r\n return \"#{arrow}#{h.text}\"\r\n\r\n buildColHeader = (axisHeaders, attrHeaders, h, rowAttrs, colAttrs, node, opts) ->\r\n # DF Recurse\r\n buildColHeader axisHeaders, attrHeaders, h[chKey], rowAttrs, colAttrs, node, opts for chKey in h.children\r\n # Process\r\n ah = axisHeaders.ah[h.col]\r\n ah.attrHeaders.push h\r\n\r\n h.node = node.counter\r\n h.onClick = collapseCol\r\n\r\n addClass h.th, \"#{classColShow} col#{h.row} colcol#{h.col} #{classColExpanded}\"\r\n h.th.setAttribute \"data-colnode\", h.node\r\n h.th.colSpan = h.childrenSpan if h.children.length isnt 0\r\n h.th.rowSpan = 2 if h.children.length is 0 and rowAttrs.length isnt 0\r\n h.th.textContent = getHeaderText h, colAttrs, opts.colSubtotalDisplay\r\n if h.children.length isnt 0 and h.col < opts.colSubtotalDisplay.disableFrom\r\n ah.expandables++\r\n ah.expandedCount += 1\r\n h.th.colSpan++ if not opts.colSubtotalDisplay.hideOnExpand\r\n if not opts.colSubtotalDisplay.disableExpandCollapse\r\n h.th.onclick = (event) ->\r\n event = event || window.event\r\n h.onClick axisHeaders, h, opts.colSubtotalDisplay \r\n h.sTh = createElement \"th\", \"pvtColLabelFiller #{classColShow} col#{h.row} colcol#{h.col} #{classColExpanded}\"\r\n h.sTh.setAttribute \"data-colnode\", h.node\r\n h.sTh.rowSpan = colAttrs.length-h.col\r\n replaceClass h.sTh, classColShow, classColHide if opts.colSubtotalDisplay.hideOnExpand\r\n h[h.children[0]].tr.appendChild h.sTh\r\n\r\n h.parent?.childrenSpan += h.th.colSpan\r\n\r\n h.clickStatus = clickStatusExpanded\r\n ah.tr.appendChild h.th\r\n h.tr = ah.tr\r\n attrHeaders.push h\r\n node.counter++ \r\n\r\n\r\n buildRowTotalsHeader = (tr, rowAttrs, colAttrs) ->\r\n th = createElement \"th\", \"pvtTotalLabel rowTotal\", opts.localeStrings.totals,\r\n rowspan: if colAttrs.length is 0 then 1 else colAttrs.length + (if rowAttrs.length is 0 then 0 else 1)\r\n tr.appendChild th\r\n\r\n buildRowHeader = (tbody, axisHeaders, attrHeaders, h, rowAttrs, colAttrs, node, opts) ->\r\n # DF Recurse\r\n buildRowHeader tbody, axisHeaders, attrHeaders, h[chKey], rowAttrs, colAttrs, node, opts for chKey in h.children\r\n # Process\r\n ah = axisHeaders.ah[h.col]\r\n ah.attrHeaders.push h\r\n\r\n h.node = node.counter\r\n h.onClick = collapseRow\r\n firstChild = h[h.children[0]] if h.children.length isnt 0\r\n\r\n addClass h.th, \"#{classRowShow} row#{h.row} rowcol#{h.col} #{classRowExpanded}\"\r\n h.th.setAttribute \"data-rownode\", h.node\r\n h.th.colSpan = 2 if h.col is rowAttrs.length-1 and colAttrs.length isnt 0\r\n h.th.rowSpan = h.childrenSpan if h.children.length isnt 0\r\n h.th.textContent = getHeaderText h, rowAttrs, opts.rowSubtotalDisplay\r\n\r\n h.tr = createElement \"tr\", \"row#{h.row}\"\r\n h.tr.appendChild h.th\r\n if h.children.length is 0\r\n tbody.appendChild h.tr\r\n else\r\n tbody.insertBefore h.tr, firstChild.tr\r\n \r\n if h.children.length isnt 0 and h.col < opts.rowSubtotalDisplay.disableFrom\r\n ++ah.expandedCount\r\n ++ah.expandables\r\n if not opts.rowSubtotalDisplay.disableExpandCollapse\r\n h.th.onclick = (event) ->\r\n event = event || window.event\r\n h.onClick axisHeaders, h, opts.rowSubtotalDisplay\r\n\r\n h.sTh = createElement \"th\", \"pvtRowLabelFiller row#{h.row} rowcol#{h.col} #{classRowExpanded} #{classRowShow}\"\r\n replaceClass h.sTh, classRowShow, classRowHide if opts.rowSubtotalDisplay.hideOnExpand\r\n h.sTh.setAttribute \"data-rownode\", h.node\r\n h.sTh.colSpan = rowAttrs.length-(h.col+1) + if colAttrs.length != 0 then 1 else 0 \r\n\r\n if opts.rowSubtotalDisplay.displayOnTop\r\n h.tr.appendChild h.sTh\r\n else\r\n h.th.rowSpan += 1 # if not opts.rowSubtotalDisplay.hideOnExpand\r\n h.sTr = createElement \"tr\", \"row#{h.row}\"\r\n h.sTr.appendChild h.sTh\r\n tbody.appendChild h.sTr\r\n\r\n h.th.rowSpan++ if h.children.length isnt 0\r\n h.parent?.childrenSpan += h.th.rowSpan\r\n\r\n h.clickStatus = clickStatusExpanded\r\n attrHeaders.push h\r\n node.counter++\r\n\r\n getTableEventHandlers = (value, rowKey, colKey, rowAttrs, colAttrs, opts) ->\r\n return if not opts.table?.eventHandlers\r\n eventHandlers = {}\r\n for own event, handler of opts.table.eventHandlers\r\n filters = {}\r\n filters[attr] = colKey[i] for own i, attr of colAttrs when colKey[i]?\r\n filters[attr] = rowKey[i] for own i, attr of rowAttrs when rowKey[i]?\r\n eventHandlers[event] = (e) -> handler(e, value, filters, pivotData)\r\n return eventHandlers\r\n\r\n buildValues = (tbody, colAttrHeaders, rowAttrHeaders, rowAttrs, colAttrs, opts) ->\r\n for rh in rowAttrHeaders when rh.col is rowAttrs.length-1 or (rh.children.length isnt 0 and rh.col < opts.rowSubtotalDisplay.disableFrom)\r\n rCls = \"pvtVal row#{rh.row} rowcol#{rh.col} #{classRowExpanded}\"\r\n if rh.children.length > 0\r\n rCls += \" pvtRowSubtotal\"\r\n rCls += if opts.rowSubtotalDisplay.hideOnExpand then \" #{classRowHide}\" else \" #{classRowShow}\"\r\n else\r\n rCls += \" #{classRowShow}\"\r\n tr = if rh.sTr then rh.sTr else rh.tr\r\n for ch in colAttrHeaders when ch.col is colAttrs.length-1 or (ch.children.length isnt 0 and ch.col < opts.colSubtotalDisplay.disableFrom)\r\n aggregator = tree[rh.flatKey][ch.flatKey] ? {value: (-> null), format: -> \"\"}\r\n val = aggregator.value()\r\n cls = \" #{rCls} col#{ch.row} colcol#{ch.col} #{classColExpanded}\"\r\n if ch.children.length > 0\r\n cls += \" pvtColSubtotal\"\r\n cls += if opts.colSubtotalDisplay.hideOnExpand then \" #{classColHide}\" else \" #{classColShow}\"\r\n else\r\n cls += \" #{classColShow}\"\r\n td = createElement \"td\", cls, aggregator.format(val),\r\n \"data-value\": val\r\n \"data-rownode\": rh.node\r\n \"data-colnode\": ch.node,\r\n getTableEventHandlers val, rh.key, ch.key, rowAttrs, colAttrs, opts\r\n\r\n tr.appendChild td\r\n\r\n # buildRowTotal\r\n totalAggregator = rowTotals[rh.flatKey]\r\n val = totalAggregator.value()\r\n td = createElement \"td\", \"pvtTotal rowTotal #{rCls}\", totalAggregator.format(val),\r\n \"data-value\": val\r\n \"data-row\": \"row#{rh.row}\"\r\n \"data-rowcol\": \"col#{rh.col}\"\r\n \"data-rownode\": rh.node,\r\n getTableEventHandlers val, rh.key, [], rowAttrs, colAttrs, opts\r\n tr.appendChild td\r\n\r\n buildColTotalsHeader = (rowAttrs, colAttrs) ->\r\n tr = createElement \"tr\"\r\n colspan = rowAttrs.length + (if colAttrs.length == 0 then 0 else 1)\r\n th = createElement \"th\", \"pvtTotalLabel colTotal\", opts.localeStrings.totals, {colspan: colspan}\r\n tr.appendChild th\r\n return tr\r\n\r\n buildColTotals = (tr, attrHeaders, rowAttrs, colAttrs, opts) ->\r\n for h in attrHeaders when h.col is colAttrs.length-1 or (h.children.length isnt 0 and h.col < opts.colSubtotalDisplay.disableFrom)\r\n clsNames = \"pvtVal pvtTotal colTotal #{classColExpanded} col#{h.row} colcol#{h.col}\"\r\n if h.children.length isnt 0\r\n clsNames += \" pvtColSubtotal\" \r\n clsNames += if opts.colSubtotalDisplay.hideOnExpand then \" #{classColHide}\" else \" #{classColShow}\"\r\n else\r\n clsNames += \" #{classColShow}\"\r\n totalAggregator = colTotals[h.flatKey]\r\n val = totalAggregator.value()\r\n td = createElement \"td\", clsNames, totalAggregator.format(val),\r\n \"data-value\": val\r\n \"data-for\": \"col#{h.col}\"\r\n \"data-colnode\": \"#{h.node}\",\r\n getTableEventHandlers val, [], h.key, rowAttrs, colAttrs, opts\r\n tr.appendChild td\r\n\r\n buildGrandTotal = (tbody, tr, rowAttrs, colAttrs, opts) ->\r\n totalAggregator = allTotal\r\n val = totalAggregator.value()\r\n td = createElement \"td\", \"pvtGrandTotal\", totalAggregator.format(val),\r\n {\"data-value\": val},\r\n getTableEventHandlers val, [], [], rowAttrs, colAttrs, opts\r\n tr.appendChild td\r\n tbody.appendChild tr\r\n\r\n collapseAxisHeaders = (axisHeaders, col, opts) ->\r\n collapsible = Math.min axisHeaders.ah.length-2, opts.disableFrom-1\r\n return if col > collapsible\r\n for i in [col..collapsible]\r\n ah = axisHeaders.ah[i]\r\n replaceClass ah.th, classExpanded, classCollapsed\r\n ah.th.textContent = \" #{arrowCollapsed} #{ah.text}\"\r\n ah.clickStatus = clickStatusCollapsed\r\n ah.onClick = expandAxis\r\n\r\n adjustAxisHeader = (axisHeaders, col, opts) ->\r\n ah = axisHeaders.ah[col]\r\n if ah.expandedCount is 0\r\n collapseAxisHeaders axisHeaders, col, opts\r\n else if ah.expandedCount is ah.expandables\r\n replaceClass ah.th, classCollapsed, classExpanded\r\n ah.th.textContent = \" #{arrowExpanded} #{ah.text}\"\r\n ah.clickStatus = clickStatusExpanded\r\n ah.onClick = collapseAxis\r\n\r\n hideChildCol = (ch) ->\r\n $(ch.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{ch.node}\\\"], th[data-colnode=\\\"#{ch.node}\\\"]\" \r\n .removeClass classColShow \r\n .addClass classColHide\r\n\r\n collapseHiddenColSubtotal = (h, opts) ->\r\n $(h.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{h.node}\\\"], th[data-colnode=\\\"#{h.node}\\\"]\" \r\n .removeClass classColExpanded\r\n .addClass classColCollapsed\r\n h.th.textContent = \" #{arrowCollapsed} #{h.text}\" if h.children.length isnt 0\r\n h.th.colSpan = 1\r\n \r\n collapseShowColSubtotal = (h, opts) ->\r\n $(h.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{h.node}\\\"], th[data-colnode=\\\"#{h.node}\\\"]\" \r\n .removeClass classColExpanded\r\n .addClass classColCollapsed\r\n .removeClass classColHide\r\n .addClass classColShow\r\n h.th.textContent = \" #{arrowCollapsed} #{h.text}\" if h.children.length isnt 0\r\n h.th.colSpan = 1\r\n\r\n collapseChildCol = (ch, h) ->\r\n collapseChildCol ch[chKey], h for chKey in ch.children when hasClass ch[chKey].th, classColShow\r\n hideChildCol ch\r\n\r\n collapseCol = (axisHeaders, h, opts) ->\r\n colSpan = h.th.colSpan - 1\r\n collapseChildCol h[chKey], h for chKey in h.children when hasClass h[chKey].th, classColShow\r\n if h.col < opts.disableFrom\r\n if hasClass h.th, classColHide\r\n collapseHiddenColSubtotal h, opts\r\n else \r\n collapseShowColSubtotal h, opts\r\n p = h.parent\r\n while p\r\n p.th.colSpan -= colSpan\r\n p = p.parent\r\n h.clickStatus = clickStatusCollapsed\r\n h.onClick = expandCol\r\n axisHeaders.ah[h.col].expandedCount--\r\n adjustAxisHeader axisHeaders, h.col, opts\r\n\r\n showChildCol = (ch) ->\r\n $(ch.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{ch.node}\\\"], th[data-colnode=\\\"#{ch.node}\\\"]\" \r\n .removeClass classColHide\r\n .addClass classColShow\r\n\r\n expandHideColSubtotal = (h) ->\r\n $(h.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{h.node}\\\"], th[data-colnode=\\\"#{h.node}\\\"]\" \r\n .removeClass \"#{classColCollapsed} #{classColShow}\" \r\n .addClass \"#{classColExpanded} #{classColHide}\" \r\n replaceClass h.th, classColHide, classColShow\r\n h.th.textContent = \" #{arrowExpanded} #{h.text}\"\r\n\r\n expandShowColSubtotal = (h) ->\r\n $(h.th).closest 'table.pvtTable'\r\n .find \"tbody tr td[data-colnode=\\\"#{h.node}\\\"], th[data-colnode=\\\"#{h.node}\\\"]\" \r\n .removeClass \"#{classColCollapsed} #{classColHide}\"\r\n .addClass \"#{classColExpanded} #{classColShow}\"\r\n h.th.colSpan++\r\n h.th.textContent = \" #{arrowExpanded} #{h.text}\"\r\n\r\n expandChildCol = (ch, opts) ->\r\n if ch.children.length isnt 0 and opts.hideOnExpand and ch.clickStatus is clickStatusExpanded\r\n replaceClass ch.th, classColHide, classColShow\r\n else\r\n showChildCol ch\r\n if ch.sTh and ch.clickStatus is clickStatusExpanded and opts.hideOnExpand\r\n replaceClass ch.sTh, classColShow, classColHide\r\n expandChildCol ch[chKey], opts for chKey in ch.children if (ch.clickStatus is clickStatusExpanded or ch.col >= opts.disableFrom)\r\n \r\n expandCol = (axisHeaders, h, opts) ->\r\n if h.clickStatus is clickStatusExpanded\r\n adjustAxisHeader axisHeaders, h.col, opts\r\n return\r\n colSpan = 0\r\n for chKey in h.children\r\n ch = h[chKey]\r\n expandChildCol ch, opts\r\n colSpan += ch.th.colSpan\r\n h.th.colSpan = colSpan\r\n\r\n if h.col < opts.disableFrom\r\n if opts.hideOnExpand\r\n expandHideColSubtotal h\r\n --colSpan\r\n else\r\n expandShowColSubtotal h\r\n p = h.parent\r\n while p\r\n p.th.colSpan += colSpan\r\n p = p.parent\r\n h.clickStatus = clickStatusExpanded\r\n h.onClick = collapseCol\r\n axisHeaders.ah[h.col].expandedCount++\r\n adjustAxisHeader axisHeaders, h.col, opts\r\n\r\n hideChildRow = (ch, opts) ->\r\n replaceClass cell, classRowShow, classRowHide for cell in ch.tr.querySelectorAll \"th, td\"\r\n replaceClass cell, classRowShow, classRowHide for cell in ch.sTr.querySelectorAll \"th, td\" if ch.sTr\r\n\r\n collapseShowRowSubtotal = (h, opts) ->\r\n h.th.textContent = \" #{arrowCollapsed} #{h.text}\"\r\n for cell in h.tr.querySelectorAll \"th, td\"\r\n removeClass cell, \"#{classRowExpanded} #{classRowHide}\"\r\n addClass cell, \"#{classRowCollapsed} #{classRowShow}\"\r\n if h.sTr\r\n for cell in h.sTr.querySelectorAll \"th, td\"\r\n removeClass cell, \"#{classRowExpanded} #{classRowHide}\"\r\n addClass cell, \"#{classRowCollapsed} #{classRowShow}\"\r\n\r\n collapseChildRow = (ch, h, opts) ->\r\n collapseChildRow ch[chKey], h, opts for chKey in ch.children\r\n hideChildRow ch, opts\r\n\r\n collapseRow = (axisHeaders, h, opts) ->\r\n collapseChildRow h[chKey], h, opts for chKey in h.children\r\n collapseShowRowSubtotal h, opts\r\n h.clickStatus = clickStatusCollapsed\r\n h.onClick = expandRow\r\n axisHeaders.ah[h.col].expandedCount--\r\n adjustAxisHeader axisHeaders, h.col, opts\r\n\r\n showChildRow = (ch, opts) ->\r\n replaceClass cell, classRowHide, classRowShow for cell in ch.tr.querySelectorAll \"th, td\"\r\n replaceClass cell, classRowHide, classRowShow for cell in ch.sTr.querySelectorAll \"th, td\" if ch.sTr\r\n\r\n expandShowRowSubtotal = (h, opts) ->\r\n h.th.textContent = \" #{arrowExpanded} #{h.text}\"\r\n for cell in h.tr.querySelectorAll \"th, td\"\r\n removeClass cell, \"#{classRowCollapsed} #{classRowHide}\"\r\n addClass cell, \"#{classRowExpanded} #{classRowShow}\"\r\n if h.sTr\r\n for cell in h.sTr.querySelectorAll \"th, td\"\r\n removeClass cell, \"#{classRowCollapsed} #{classRowHide}\"\r\n addClass cell, \"#{classRowExpanded} #{classRowShow}\"\r\n\r\n expandHideRowSubtotal = (h, opts) ->\r\n h.th.textContent = \" #{arrowExpanded} #{h.text}\"\r\n for cell in h.tr.querySelectorAll \"th, td\"\r\n removeClass cell, \"#{classRowCollapsed} #{classRowShow}\"\r\n addClass cell, \"#{classRowExpanded} #{classRowHide}\"\r\n removeClass h.th, \"#{classRowCollapsed} #{classRowHide}\"\r\n addClass cell, \"#{classRowExpanded} #{classRowShow}\"\r\n if h.sTr\r\n for cell in h.sTr.querySelectorAll \"th, td\"\r\n removeClass cell, \"#{classRowCollapsed} #{classRowShow}\"\r\n addClass cell, \"#{classRowExpanded} #{classRowHide}\"\r\n\r\n expandChildRow = (ch, opts) ->\r\n if ch.children.length isnt 0 and opts.hideOnExpand and ch.clickStatus is clickStatusExpanded\r\n replaceClass ch.th, classRowHide, classRowShow\r\n else\r\n showChildRow ch, opts\r\n if ch.sTh and ch.clickStatus is clickStatusExpanded and opts.hideOnExpand\r\n replaceClass ch.sTh, classRowShow, classRowHide\r\n expandChildRow ch[chKey], opts for chKey in ch.children if (ch.clickStatus is clickStatusExpanded or ch.col >= opts.disableFrom)\r\n\r\n expandRow = (axisHeaders, h, opts) ->\r\n if h.clickStatus is clickStatusExpanded\r\n adjustAxisHeader axisHeaders, h.col, opts\r\n return\r\n for chKey in h.children\r\n ch = h[chKey]\r\n expandChildRow ch, opts\r\n if h.children.length isnt 0 \r\n if opts.hideOnExpand\r\n expandHideRowSubtotal h, opts\r\n else\r\n expandShowRowSubtotal h, opts\r\n h.clickStatus = clickStatusExpanded\r\n h.onClick = collapseRow\r\n axisHeaders.ah[h.col].expandedCount++\r\n adjustAxisHeader axisHeaders, h.col, opts\r\n \r\n collapseAxis = (axisHeaders, col, attrs, opts) ->\r\n collapsible = Math.min attrs.length-2, opts.disableFrom-1\r\n return if col > collapsible\r\n axisHeaders.collapseAttrHeader axisHeaders, h, opts for h in axisHeaders.ah[i].attrHeaders when h.clickStatus is clickStatusExpanded and h.children.length isnt 0 for i in [collapsible..col] by -1\r\n\r\n expandAxis = (axisHeaders, col, attrs, opts) ->\r\n ah = axisHeaders.ah[col]\r\n axisHeaders.expandAttrHeader axisHeaders, h, opts for h in axisHeaders.ah[i].attrHeaders for i in [0..col] \r\n # when h.clickStatus is clickStatusCollapsed and h.children.length isnt 0 for i in [0..col] \r\n\r\n main = (rowAttrs, rowKeys, colAttrs, colKeys) ->\r\n rowAttrHeaders = []\r\n colAttrHeaders = []\r\n\r\n colKeyHeaders = processKeys colKeys, \"pvtColLabel\" if colAttrs.length isnt 0 and colKeys.length isnt 0\r\n rowKeyHeaders = processKeys rowKeys, \"pvtRowLabel\" if rowAttrs.length isnt 0 and rowKeys.length isnt 0\r\n\r\n result = createElement \"table\", \"pvtTable\", null, {style: \"display: none;\"}\r\n\r\n thead = createElement \"thead\"\r\n result.appendChild thead\r\n\r\n if colAttrs.length isnt 0\r\n colAxisHeaders = buildColAxisHeaders thead, rowAttrs, colAttrs, opts\r\n node = counter: 0\r\n buildColHeader colAxisHeaders, colAttrHeaders, colKeyHeaders[chKey], rowAttrs, colAttrs, node, opts for chKey in colKeyHeaders.children\r\n buildRowTotalsHeader colAxisHeaders.ah[0].tr, rowAttrs, colAttrs\r\n\r\n tbody = createElement \"tbody\"\r\n result.appendChild tbody\r\n if rowAttrs.length isnt 0\r\n rowAxisHeaders = buildRowAxisHeaders thead, rowAttrs, colAttrs, opts\r\n buildRowTotalsHeader rowAxisHeaders.tr, rowAttrs, colAttrs if colAttrs.length is 0\r\n node = counter: 0\r\n buildRowHeader tbody, rowAxisHeaders, rowAttrHeaders, rowKeyHeaders[chKey], rowAttrs, colAttrs, node, opts for chKey in rowKeyHeaders.children\r\n\r\n buildValues tbody, colAttrHeaders, rowAttrHeaders, rowAttrs, colAttrs, opts\r\n tr = buildColTotalsHeader rowAttrs, colAttrs\r\n buildColTotals tr, colAttrHeaders, rowAttrs, colAttrs, opts if colAttrs.length > 0\r\n buildGrandTotal tbody, tr, rowAttrs, colAttrs, opts\r\n\r\n collapseAxis colAxisHeaders, opts.colSubtotalDisplay.collapseAt, colAttrs, opts.colSubtotalDisplay\r\n collapseAxis rowAxisHeaders, opts.rowSubtotalDisplay.collapseAt, rowAttrs, opts.rowSubtotalDisplay\r\n\r\n result.setAttribute \"data-numrows\", rowKeys.length\r\n result.setAttribute \"data-numcols\", colKeys.length\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 # \r\n # Aggregators\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/package.json b/package.json index a201f33..7302877 100644 --- a/package.json +++ b/package.json @@ -31,15 +31,19 @@ "dependencies": { "pivottable": ">=2.7.0" }, + "scripts": { + "build": "gulp" + }, "devDependencies": { - "gulp": "^3.8.10", + "gulp": "^3.9.1", "gulp-bump": "^2.5.1", + "gulp-clean-css": "^3.9.0", "gulp-coffee": "^2.2.0", "gulp-concat": "^2.4.2", "gulp-debug": "^3.1.0", "gulp-filter": "^4.0.0", "gulp-git": "^1.12.0", - "gulp-clean-css": "^3.9.0", + "gulp-minify-css": "^1.2.4", "gulp-rename": "^1.2.0", "gulp-serve": "^1.2.0", "gulp-sourcemaps": "^1.2.8", diff --git a/subtotal.coffee b/subtotal.coffee index c490d14..f93a9f4 100644 --- a/subtotal.coffee +++ b/subtotal.coffee @@ -373,7 +373,7 @@ callWithJQuery ($) -> "data-row": "row#{rh.row}" "data-rowcol": "col#{rh.col}" "data-rownode": rh.node, - getTableEventHandlers val, rh.key, [], rowAttrs, colAttrs, opts + getTableEventHandlers val, rh.key, [], rowAttrs, colAttrs, opts tr.appendChild td buildColTotalsHeader = (rowAttrs, colAttrs) ->