diff --git a/dist/hot_renderers.js b/dist/hot_renderers.js new file mode 100644 index 00000000..188bd01e --- /dev/null +++ b/dist/hot_renderers.js @@ -0,0 +1,489 @@ +(function() { + var callWithJQuery, + hasProp1 = {}.hasOwnProperty, + bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; + + callWithJQuery = function(pivotModule) { + if (typeof exports === "object" && typeof module === "object") { + return pivotModule(require("jquery")); + } else if (typeof define === "function" && define.amd) { + return define(["jquery"], pivotModule); + } else { + return pivotModule(jQuery); + } + }; + + callWithJQuery(function($) { + var ScrollEvent, colEnd, colLimit, colStart, colTotalFlag, elementAppend, getExtendedOpts, grandTotalFlag, hasProp, isOverlap, keydownendEvent, makeClickHandler, pivotTableRenderer, rowEnd, rowLimit, rowStart, rowTotalFlag, scrollColrender, scrollDown, scrollRowrender; + hasProp = {}.hasOwnProperty; + colLimit = 99; + rowLimit = 99; + rowStart = 0; + colStart = 0; + colEnd = colStart + colLimit; + rowEnd = rowStart + rowLimit; + scrollDown = false; + grandTotalFlag = false; + colTotalFlag = false; + rowTotalFlag = false; + isOverlap = function(arr, i, j) { + if (j === 0) { + return -1; + } + if (arr[j][i - 1] === arr[j - 1][i - 1] && arr[j][i] === arr[j - 1][i]) { + return 1; + } + return -1; + }; + scrollColrender = function(pivotData, opts) { + return function() { + var colAttrs, createPivotChild, result, rowKeys, scrollPositionX, scrollWidth, tbodyChildNodes, theadChildNodes; + scrollWidth = this.scrollWidth; + scrollPositionX = this.scrollLeft + this.offsetWidth; + colAttrs = pivotData.colAttrs; + rowKeys = pivotData.getRowKeys(); + result = document.getElementsByClassName('pvtTable').item(0); + createPivotChild = elementAppend(pivotData, opts); + if (!rowTotalFlag && (((scrollPositionX - scrollWidth) < 0) || (scrollPositionX - scrollWidth) === 1)) { + colStart = colEnd; + colEnd = colStart + colLimit; + theadChildNodes = result.getElementsByTagName('thead').item(0).childNodes; + theadChildNodes.forEach(node, i)(function() { + var colAttr, j, results; + results = []; + for (j in colAttrs) { + if (!hasProp1.call(colAttrs, j)) continue; + colAttr = colAttrs[j]; + if (parseInt(i) === parseInt(j)) { + results.push(createPivotChild('thead-th', rowStart, rowEnd, colStart, colEnd, parseInt(j), node)); + } else { + results.push(void 0); + } + } + return results; + }); + tbodyChildNodes = result.getElementsByTagName('tbody').item(0).childNodes; + tbodyChildNodes.forEach(node, i)(function() { + var j, k, ref, results; + results = []; + for (j = k = 0, ref = rowEnd; 0 <= ref ? k <= ref : k >= ref; j = 0 <= ref ? ++k : --k) { + if (parseInt(i) === parseInt(j)) { + if (i >= rowKeys.length) { + results.push(createPivotChild('col-total-td', rowStart, rowEnd, colStart, colEnd, null, node)); + } else { + results.push(createPivotChild('tbody-td', rowStart, rowEnd, colStart, colEnd, parseInt(j), node)); + } + } else { + results.push(void 0); + } + } + return results; + }); + if (opts.type === 'Heatmap') { + return $(result).heatmap("heatmap", opts); + } + } + }; + }; + scrollRowrender = function(pivotData, opts) { + return function() { + var createPivotChild, i, ref, result, rowKey, rowKeys, scrollHeight, scrollPositionY, tbody, tr; + scrollHeight = $(document).height(); + scrollPositionY = $(window).height() + $(window).scrollTop(); + if ((scrollHeight - scrollPositionY) / scrollHeight === 0) { + rowKeys = pivotData.getRowKeys(); + result = document.getElementsByClassName('pvtTable').item(0); + tbody = result.getElementsByTagName('tbody').item(0); + createPivotChild = elementAppend(pivotData, opts); + if (!colTotalFlag) { + rowStart = rowEnd; + rowEnd = rowStart + rowLimit; + ref = rowKeys.slice(rowStart, rowEnd); + for (i in ref) { + if (!hasProp1.call(ref, i)) continue; + rowKey = ref[i]; + tr = document.createElement("tr"); + createPivotChild('tbody-th', rowStart, rowEnd, colStart, colEnd, parseInt(i), tr); + createPivotChild('tbody-td', rowStart, rowEnd, colStart, colEnd, parseInt(i), tr); + tbody.appendChild(tr); + } + createPivotChild('col-total-th', rowStart, rowEnd, colStart, colEnd, null, tbody); + if (opts.type === 'Heatmap') { + return $(result).heatmap("heatmap", opts); + } + } + } + }; + }; + keydownendEvent = function(e, pivotData, opts) { + if (e.code === 'PageDown') { + scrollRowrender(pivotData, opts); + } + if (e.code === 'end') { + scrollRowrender(pivotData, opts); + } + if (e.ecode === 'ArrowDown') { + return scrollRowrender(pivotData, opts); + } + }; + + /* + Scroll Event Class + */ + ScrollEvent = (function() { + function ScrollEvent(pivotData, opts) { + if (opts == null) { + opts = {}; + } + this.removeRenderEvent = bind(this.removeRenderEvent, this); + this.addRenderEvent = bind(this.addRenderEvent, this); + this.fn = { + rowrender: scrollRowrender(pivotData, opts), + colrender: scrollColrender(pivotData, opts), + keydownend: function(event) { + return keydownendEvent(event, pivotData, opts); + } + }; + this.getKeydownendEvent = function() { + return this.fn.keydownend; + }; + this.getRowrenderEvent = function() { + return this.fn.rowrender; + }; + this.getColRenderEvent = (function(_this) { + return function() { + return _this.fn.colrender; + }; + })(this); + } + + ScrollEvent.prototype.addRenderEvent = function() { + window.addEventListener('scroll', this.getRowrenderEvent()); + window.addEventListener('keydown', this.getKeydownendEvent()); + return document.getElementById('output').addEventListener('scroll', this.getColRenderEvent()); + }; + + ScrollEvent.prototype.removeRenderEvent = function() { + window.removeEventListener('scroll', this.getRowRenderEvent()); + window.removeEventListener('keydown', this.getKeydownendEvent()); + return document.getElementById('output').removeEventListener('scroll', this.getColRenderEvent()); + }; + + return ScrollEvent; + + })(); + elementAppend = function(pivotData, opts) { + var colAttrs, colKeys, getClickHandler, rowAttrs, rowKeys; + colAttrs = pivotData.colAttrs; + rowAttrs = pivotData.rowAttrs; + rowKeys = pivotData.getRowKeys(); + colKeys = pivotData.getColKeys(); + getClickHandler = makeClickHandler(opts); + return function(element, rowStart, rowEnd, colStart, colEnd, i, target) { + var fn; + fn = { + 'thead-th': function() { + var colKey, j, ref, th, x; + ref = colKeys.slice(colStart, colEnd); + for (j in ref) { + if (!hasProp1.call(ref, j)) continue; + colKey = ref[j]; + x = isOverlap(colKeys, parseInt(i), parseInt(j)); + th = document.createElement("th"); + th.className = "pvtColLabel"; + if (x === -1) { + th.textContent = colKey[i]; + th.setAttribute('style', 'border-right:none;'); + } else { + th.setAttribute('style', 'border-left:none;border-right:none;'); + } + if (parseInt(i) === colAttrs.length - 1 && rowAttrs.length !== 0) { + th.setAttribute("rowspan", 2); + } + target.appendChild(th); + if (parseInt(j) === colKeys.length - 1 && !rowTotalFlag) { + if (parseInt(i) === 0 && opts.table.rowTotals) { + th = document.createElement("th"); + th.className = "pvtTotalLabel pvtRowTotalLabel"; + th.innerHTML = opts.localeStrings.totals; + th.setAttribute("rowspan", colAttrs.length + (rowAttrs.length === 0 ? 0 : 1)); + target.appendChild(th); + } + } + } + return target; + }, + 'thead-th-total': function() { + var r, th, tr; + if (rowAttrs.length !== 0) { + tr = document.createElement("tr"); + for (i in rowAttrs) { + if (!hasProp1.call(rowAttrs, i)) continue; + r = rowAttrs[i]; + th = document.createElement("th"); + th.className = "pvtAxisLabel"; + th.textContent = r; + tr.appendChild(th); + } + th = document.createElement("th"); + if (colAttrs.length === 0) { + th.className = "pvtTotalLabel pvtRowTotalLabel"; + th.innerHTML = opts.localeStrings.totals; + } + tr.appendChild(th); + target.appendChild(tr); + } + return target; + }, + 'tbody-th': function() { + var j, rowKey, th, txt, x; + rowKey = rowKeys[i]; + for (j in rowKey) { + if (!hasProp1.call(rowKey, j)) continue; + txt = rowKey[j]; + th = document.createElement("th"); + th.className = "pvtRowLabel"; + x = isOverlap(rowKeys, parseInt(j), parseInt(i)); + if (x === -1) { + th.textContent = txt; + th.setAttribute('style', 'border-bottom:none;'); + } else { + th.setAttribute('style', 'border-bottom:none;border-top:none;'); + } + if (parseInt(j) === rowAttrs.length - 1 && colAttrs.length !== 0) { + th.setAttribute("colspan", 2); + } + target.appendChild(th); + } + return target; + }, + 'tbody-td': function() { + var aggregator, colKey, j, ref, rowKey, td, val; + rowKey = rowKeys[i]; + ref = colKeys.slice(colStart, colEnd); + for (j in ref) { + if (!hasProp1.call(ref, j)) continue; + colKey = ref[j]; + colKey = colKeys[j]; + aggregator = pivotData.getAggregator(rowKey, colKey); + val = aggregator.value(); + td = document.createElement("td"); + td.className = "pvtVal row" + i + " col" + j; + td.textContent = aggregator.format(val); + td.setAttribute("data-value", val); + if (getClickHandler != null) { + td.onclick = getClickHandler(val, rowKey, colKey); + } + target.appendChild(td); + } + this['row-total-td'](); + return target; + }, + 'row-total-td': function() { + var rowKey, td, totalAggregator, val; + rowKey = rowKeys[i]; + if (colEnd >= colKeys.length) { + if (opts.table.rowTotals || colAttrs.length === 0) { + rowTotalFlag = true; + totalAggregator = pivotData.getAggregator(rowKey, []); + val = totalAggregator.value(); + td = document.createElement("td"); + td.className = "pvtTotal rowTotal"; + td.textContent = totalAggregator.format(val); + td.setAttribute("data-value", val); + if (getClickHandler != null) { + td.onclick = getClickHandler(val, rowKey, []); + } + td.setAttribute("data-for", "row" + i); + target.appendChild(td); + } + } + return target; + }, + 'col-total-th': function(tr) { + var th; + tr = tr || document.createElement("tr"); + if (rowEnd > rowKeys.length && !colTotalFlag) { + if (opts.table.colTotals || rowAttrs.length === 0) { + colTotalFlag = true; + th = document.createElement("th"); + th.className = "pvtTotalLabel pvtColTotalLabel"; + th.innerHTML = opts.localeStrings.totals; + th.setAttribute("colspan", rowAttrs.length + (colAttrs.length === 0 ? 0 : 1)); + tr.appendChild(th); + this['col-total-td'](tr); + target.appendChild(tr); + } + } + return target; + }, + 'col-total-td': function(tr) { + var colKey, j, k, ref, ref1, td, totalAggregator, val; + tr = tr || target; + if (colAttrs.length === 0) { + this['grand-total-td'](tr); + } + for (j = k = ref = colStart, ref1 = colEnd; ref <= ref1 ? k <= ref1 : k >= ref1; j = ref <= ref1 ? ++k : --k) { + if (hasProp.call(colKeys, j)) { + colKey = colKeys[j]; + totalAggregator = pivotData.getAggregator([], colKey); + val = totalAggregator.value(); + td = document.createElement("td"); + td.className = "pvtTotal colTotal"; + td.textContent = totalAggregator.format(val); + td.setAttribute("data-value", val); + if (getClickHandler != null) { + td.onclick = getClickHandler(val, [], colKey); + } + td.setAttribute("data-for", "col" + j); + tr.appendChild(td); + if (colKeys.length - 1 === j) { + this['grand-total-td'](tr); + } + } + } + return tr; + }, + 'grand-total-td': function(tr) { + var td, totalAggregator, val; + if ((opts.table.rowTotals || colAttrs.length === 0) || !grandTotalFlag) { + grandTotalFlag = true; + totalAggregator = pivotData.getAggregator([], []); + val = totalAggregator.value(); + td = document.createElement("td"); + td.className = "pvtGrandTotal"; + td.textContent = totalAggregator.format(val); + td.setAttribute("data-value", val); + if (getClickHandler != null) { + td.onclick = getClickHandler(val, [], []); + } + tr.appendChild(td); + } + return tr; + } + }; + return fn[element](); + }; + }; + makeClickHandler = function(opts) { + var getClickHandler; + if (opts.table.clickCallback) { + getClickHandler = function(value, rowValues, colValues) { + var attr, filters, i, j; + filters = {}; + for (i in colAttrs) { + if (!hasProp1.call(colAttrs, i)) continue; + attr = colAttrs[i]; + if (colValues[i] != null) { + filters[attr] = colValues[i]; + } + } + for (j in rowAttrs) { + if (!hasProp1.call(rowAttrs, j)) continue; + attr = rowAttrs[j]; + if (rowValues[j] != null) { + filters[attr] = rowValues[j]; + } + } + return function(e) { + return opts.table.clickCallback(e, value, filters, pivotData); + }; + }; + } + return getClickHandler; + }; + getExtendedOpts = function(opts, type) { + var defaults; + defaults = { + table: { + clickCallback: null, + rowTotals: true, + colTotals: true + }, + localeStrings: { + totals: "Totals" + }, + type: type + }; + return $.extend(true, {}, defaults, opts); + }; + pivotTableRenderer = function(pivotData, opts) { + var c, colAttrs, colKeys, createPivotChild, i, j, ref, result, rowAttrs, rowKey, rowKeys, scrollevent, tbody, th, thead, tr; + colAttrs = pivotData.colAttrs; + rowAttrs = pivotData.rowAttrs; + rowKeys = pivotData.getRowKeys(); + colKeys = pivotData.getColKeys(); + rowLimit = pivotData.getRowLimit() > 0 ? pivotData.getRowLimit() : rowKeys.length; + colLimit = pivotData.getColLimit() > 0 ? pivotData.getColLimit() : colKeys.length; + rowStart = 0; + colStart = 0; + colEnd = colStart + colLimit; + rowEnd = rowStart + rowLimit; + grandTotalFlag = false; + colTotalFlag = false; + rowTotalFlag = false; + result = document.createElement("table"); + result.className = "pvtTable"; + result.setAttribute("data-numrows", colEnd); + result.setAttribute("data-numcols", rowEnd); + createPivotChild = elementAppend(pivotData, opts); + scrollevent = new ScrollEvent(pivotData, opts); + scrollevent.addRenderEvent(); + thead = document.createElement("thead"); + for (j in colAttrs) { + if (!hasProp1.call(colAttrs, j)) continue; + c = colAttrs[j]; + tr = document.createElement("tr"); + if (parseInt(j) === 0 && rowAttrs.length !== 0) { + th = document.createElement("th"); + th.setAttribute("colspan", rowAttrs.length); + th.setAttribute("rowspan", colAttrs.length); + tr.appendChild(th); + } + th = document.createElement("th"); + th.className = "pvtAxisLabel"; + th.textContent = c; + tr.appendChild(th); + createPivotChild('thead-th', rowStart, rowEnd, colStart, colEnd, parseInt(j), tr); + thead.appendChild(tr); + } + createPivotChild('thead-th-total', rowStart, rowEnd, colStart, colEnd, null, thead); + result.appendChild(thead); + tbody = document.createElement("tbody"); + ref = rowKeys.slice(rowStart, rowEnd); + for (i in ref) { + if (!hasProp1.call(ref, i)) continue; + rowKey = ref[i]; + tr = document.createElement("tr"); + createPivotChild('tbody-th', rowStart, rowEnd, colStart, colEnd, parseInt(i), tr); + createPivotChild('tbody-td', rowStart, rowEnd, colStart, colEnd, parseInt(i), tr); + tbody.appendChild(tr); + } + createPivotChild('col-total-th', rowStart, rowEnd, colStart, colEnd, null, tbody); + result.appendChild(tbody); + return result; + }; + return $.pivotUtilities.hot_renderes = { + renderer: { + 'Table': function(data, opts) { + var extendedOpts; + extendedOpts = getExtendedOpts(opts, 'Table'); + return pivotTableRenderer(data, extendedOpts); + }, + 'Heatmap': function(data, opts) { + var extendedOpts; + extendedOpts = getExtendedOpts(opts, 'Heatmap'); + return $(pivotTableRenderer(data, extendedOpts)).heatmap("heatmap", extendedOpts); + } + }, + removeScrollevent: function() { + if (scrollevent) { + return scrollevent.removeRenderEvent(); + } + } + }; + }); + +}).call(this); + +//# sourceMappingURL=hot_renderers.js.map diff --git a/dist/hot_renderers.js.map b/dist/hot_renderers.js.map new file mode 100644 index 00000000..652cc921 --- /dev/null +++ b/dist/hot_renderers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hot_renderers.js","sources":["hot_renderers.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;AACX,QAAA;IAAA,OAAA,GAAU,EAAE,CAAC;IACb,QAAA,GAAW;IACX,QAAA,GAAW;IACX,QAAA,GAAW;IACX,QAAA,GAAW;IACX,MAAA,GAAS,QAAA,GAAW;IACpB,MAAA,GAAS,QAAA,GAAW;IACpB,UAAA,GAAa;IACb,cAAA,GAAiB;IACjB,YAAA,GAAe;IACf,YAAA,GAAe;IAEf,SAAA,GAAY,SAAC,GAAD,EAAM,CAAN,EAAS,CAAT;MACR,IAAG,CAAA,KAAK,CAAR;AACI,eAAO,CAAC,EADZ;;MAEA,IAAG,GAAI,CAAA,CAAA,CAAG,CAAA,CAAA,GAAE,CAAF,CAAP,KAAe,GAAI,CAAA,CAAA,GAAE,CAAF,CAAK,CAAA,CAAA,GAAE,CAAF,CAAxB,IAAgC,GAAI,CAAA,CAAA,CAAG,CAAA,CAAA,CAAP,KAAa,GAAI,CAAA,CAAA,GAAE,CAAF,CAAK,CAAA,CAAA,CAAzD;AACI,eAAO,EADX;;AAEA,aAAO,CAAC;IALA;IAQZ,eAAA,GAAkB,SAAC,SAAD,E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rB,CAAC,CAAC,cAAc,CAAC,YAAjB,GACI;MAAA,QAAA,EACI;QAAA,OAAA,EAAS,SAAC,IAAD,EAAO,IAAP;AACL,cAAA;UAAA,YAAA,GAAe,eAAA,CAAgB,IAAhB,EAAsB,OAAtB;AACf,iBAAO,kBAAA,CAAmB,IAAnB,EAAyB,YAAzB;QAFF,CAAT;QAGA,SAAA,EAAW,SAAC,IAAD,EAAO,IAAP;AACP,cAAA;UAAA,YAAA,GAAe,eAAA,CAAgB,IAAhB,EAAsB,SAAtB;AACf,iBAAO,CAAA,CAAE,kBAAA,CAAmB,IAAnB,EAAyB,YAAzB,CAAF,CAAyC,CAAC,OAA1C,CAAkD,SAAlD,EAA6D,YAA7D;QAFA,CAHX;OADJ;MAOA,iBAAA,EAAmB,SAAA;QACf,IAAG,WAAH;AACI,iBAAO,WAAW,CAAC,iBAAZ,CAAA,EADX;;MADe,CAPnB;;EAnVO,CAAf;AATA","sourcesContent":["callWithJQuery = (pivotModule) ->\n if typeof exports is \"object\" and typeof module is \"object\" # CommonJS\n pivotModule require(\"jquery\")\n else if typeof define is \"function\" and define.amd # AMD\n define [\"jquery\"], pivotModule\n # Plain browser env\n else\n pivotModule jQuery\n\ncallWithJQuery ($) ->\n hasProp = {}.hasOwnProperty\n colLimit = 99\n rowLimit = 99\n rowStart = 0\n colStart = 0\n colEnd = colStart + colLimit\n rowEnd = rowStart + rowLimit\n scrollDown = false\n grandTotalFlag = false\n colTotalFlag = false\n rowTotalFlag = false\n\n isOverlap = (arr, i, j) ->\n if j == 0\n return -1\n if arr[j][i-1] == arr[j-1][i-1] && arr[j][i] == arr[j-1][i]\n return 1\n return -1 \n \n\n scrollColrender = (pivotData, opts) ->\n return () ->\n scrollWidth = this.scrollWidth;\n scrollPositionX = this.scrollLeft + this.offsetWidth\n colAttrs = pivotData.colAttrs\n rowKeys = pivotData.getRowKeys()\n result = document.getElementsByClassName('pvtTable').item(0)\n createPivotChild = elementAppend(pivotData, opts)\n\n if !rowTotalFlag && (((scrollPositionX - scrollWidth) < 0) || (scrollPositionX - scrollWidth) == 1)\n colStart = colEnd\n colEnd = colStart + colLimit\n theadChildNodes = result.getElementsByTagName('thead').item(0).childNodes\n theadChildNodes.forEach(node, i) ->\n for own j, colAttr of colAttrs\n if parseInt(i) == parseInt(j)\n createPivotChild('thead-th', rowStart, rowEnd, colStart, colEnd, parseInt(j), node)\n \n \n tbodyChildNodes = result.getElementsByTagName('tbody').item(0).childNodes\n tbodyChildNodes.forEach(node, i) ->\n for j in [0..rowEnd]\n if parseInt(i) == parseInt(j) \n if i >= rowKeys.length\n createPivotChild('col-total-td', rowStart, rowEnd, colStart, colEnd, null, node)\n else \n createPivotChild('tbody-td', rowStart, rowEnd, colStart, colEnd, parseInt(j), node)\n if opts.type == 'Heatmap'\n $(result).heatmap(\"heatmap\", opts)\n\n scrollRowrender = (pivotData, opts) ->\n return () ->\n scrollHeight = $(document).height()\n scrollPositionY = $(window).height() + $(window).scrollTop()\n if (scrollHeight - scrollPositionY) / scrollHeight == 0\n rowKeys = pivotData.getRowKeys()\n result = document.getElementsByClassName('pvtTable').item(0)\n tbody = result.getElementsByTagName('tbody').item(0)\n createPivotChild = elementAppend(pivotData, opts)\n if !colTotalFlag\n rowStart = rowEnd\n rowEnd = rowStart + rowLimit\n for own i, rowKey of rowKeys.slice(rowStart, rowEnd)\n tr = document.createElement(\"tr\")\n createPivotChild('tbody-th', rowStart, rowEnd, colStart, colEnd, parseInt(i), tr)\n createPivotChild('tbody-td', rowStart, rowEnd, colStart, colEnd, parseInt(i), tr)\n tbody.appendChild(tr)\n createPivotChild('col-total-th', rowStart, rowEnd, colStart, colEnd, null, tbody)\n if opts.type == 'Heatmap'\n $(result).heatmap(\"heatmap\", opts)\n\n\n keydownendEvent = (e, pivotData, opts) ->\n if e.code == 'PageDown'\n scrollRowrender(pivotData, opts)\n if e.code == 'end'\n scrollRowrender(pivotData, opts)\n if e.ecode == 'ArrowDown'\n scrollRowrender(pivotData, opts) \n\n \n ###\n Scroll Event Class\n ###\n \n class ScrollEvent\n constructor: (pivotData, opts = {}) ->\n @fn = \n rowrender: scrollRowrender(pivotData, opts)\n colrender: scrollColrender(pivotData, opts)\n keydownend: (event) ->\n return keydownendEvent(event, pivotData, opts)\n\n @getKeydownendEvent = () ->\n return @fn.keydownend\n \n @getRowrenderEvent = () ->\n return @fn.rowrender\n \n @getColRenderEvent = () =>\n return @fn.colrender\n addRenderEvent: () =>\n window.addEventListener('scroll', @getRowrenderEvent())\n window.addEventListener('keydown', @getKeydownendEvent())\n document.getElementById('output').addEventListener('scroll', @getColRenderEvent())\n removeRenderEvent: () =>\n window.removeEventListener('scroll', @getRowRenderEvent())\n window.removeEventListener('keydown', @getKeydownendEvent())\n document.getElementById('output').removeEventListener('scroll', @getColRenderEvent())\n\n\n elementAppend = (pivotData, opts) ->\n colAttrs = pivotData.colAttrs\n rowAttrs = pivotData.rowAttrs\n rowKeys = pivotData.getRowKeys()\n colKeys = pivotData.getColKeys()\n getClickHandler = makeClickHandler(opts)\n return (element, rowStart, rowEnd, colStart, colEnd, i, target) ->\n fn = \n 'thead-th': () ->\n for own j, colKey of colKeys.slice(colStart, colEnd)\n x = isOverlap(colKeys, parseInt(i), parseInt(j))\n th = document.createElement(\"th\")\n th.className = \"pvtColLabel\"\n if x == -1\n th.textContent = colKey[i]\n th.setAttribute('style', 'border-right:none;')\n else\n th.setAttribute('style', 'border-left:none;border-right:none;')\n \n if (parseInt(i) == colAttrs.length-1 && rowAttrs.length != 0)\n th.setAttribute(\"rowspan\", 2)\n target.appendChild th\n\n if (parseInt(j) == colKeys.length-1 && !rowTotalFlag)\n if parseInt(i) == 0 && opts.table.rowTotals\n th = document.createElement(\"th\")\n th.className = \"pvtTotalLabel pvtRowTotalLabel\"\n th.innerHTML = opts.localeStrings.totals\n th.setAttribute(\"rowspan\", colAttrs.length + (if rowAttrs.length == 0 then 0 else 1))\n target.appendChild th\n return target\n 'thead-th-total': () ->\n # pvtAxisLabel\n if rowAttrs.length != 0\n tr = document.createElement(\"tr\")\n for own i, r of rowAttrs\n # r = rowAttrs[i]\n th = document.createElement(\"th\")\n th.className = \"pvtAxisLabel\"\n th.textContent = r\n tr.appendChild th\n th = document.createElement(\"th\")\n if colAttrs.length == 0\n # th.setAttribute(\"rowspan\", 2)\n th.className = \"pvtTotalLabel pvtRowTotalLabel\"\n th.innerHTML = opts.localeStrings.totals\n tr.appendChild th\n target.appendChild tr\n return target\n 'tbody-th': () ->\n rowKey = rowKeys[i]\n # tbody tr th\n for own j, txt of rowKey\n th = document.createElement(\"th\")\n th.className = \"pvtRowLabel\"\n x = isOverlap(rowKeys, parseInt(j), parseInt(i))\n if x == -1\n th.textContent = txt\n th.setAttribute('style', 'border-bottom:none;')\n else\n th.setAttribute('style', 'border-bottom:none;border-top:none;')\n if parseInt(j) == rowAttrs.length-1 && colAttrs.length != 0\n th.setAttribute(\"colspan\", 2)\n target.appendChild th\n return target\n 'tbody-td': () -> \n # tbody tr td\n rowKey = rowKeys[i]\n for own j, colKey of colKeys.slice(colStart, colEnd)\n colKey = colKeys[j]\n aggregator = pivotData.getAggregator(rowKey, colKey)\n val = aggregator.value()\n td = document.createElement(\"td\")\n td.className = \"pvtVal row\" + i + \" col\" + j\n td.textContent = aggregator.format(val)\n td.setAttribute(\"data-value\", val)\n if getClickHandler?\n td.onclick = getClickHandler(val, rowKey, colKey)\n target.appendChild td\n this['row-total-td']()\n return target\n 'row-total-td': () ->\n # col Total\n rowKey = rowKeys[i]\n if colEnd >= colKeys.length\n if (opts.table.rowTotals || colAttrs.length == 0)\n rowTotalFlag = true\n totalAggregator = pivotData.getAggregator(rowKey, [])\n val = totalAggregator.value()\n td = document.createElement(\"td\")\n td.className = \"pvtTotal rowTotal\"\n td.textContent = totalAggregator.format(val)\n td.setAttribute(\"data-value\", val)\n if getClickHandler?\n td.onclick = getClickHandler(val, rowKey, [])\n td.setAttribute(\"data-for\", \"row\" + i)\n target.appendChild td\n return target\n 'col-total-th': (tr) ->\n tr = tr || document.createElement(\"tr\")\n if rowEnd > rowKeys.length && !colTotalFlag\n if opts.table.colTotals || rowAttrs.length == 0\n colTotalFlag = true\n th = document.createElement(\"th\")\n th.className = \"pvtTotalLabel pvtColTotalLabel\"\n th.innerHTML = opts.localeStrings.totals\n th.setAttribute(\"colspan\", rowAttrs.length + (if colAttrs.length == 0 then 0 else 1))\n tr.appendChild th\n this['col-total-td'](tr)\n target.appendChild tr\n return target\n 'col-total-td': (tr) ->\n tr = tr || target\n if colAttrs.length == 0 \n this['grand-total-td'](tr)\n for j in [colStart..colEnd]\n if hasProp.call(colKeys, j)\n colKey = colKeys[j]\n totalAggregator = pivotData.getAggregator([], colKey)\n val = totalAggregator.value()\n td = document.createElement(\"td\")\n td.className = \"pvtTotal colTotal\"\n td.textContent = totalAggregator.format(val)\n td.setAttribute(\"data-value\", val)\n if getClickHandler?\n td.onclick = getClickHandler(val, [], colKey)\n td.setAttribute(\"data-for\", \"col\" + j)\n tr.appendChild td\n if colKeys.length - 1 == j\n this['grand-total-td'](tr)\n return tr\n 'grand-total-td': (tr) ->\n if ((opts.table.rowTotals || colAttrs.length == 0) || !grandTotalFlag)\n grandTotalFlag = true\n totalAggregator = pivotData.getAggregator([], [])\n val = totalAggregator.value()\n td = document.createElement(\"td\")\n td.className = \"pvtGrandTotal\"\n td.textContent = totalAggregator.format(val)\n td.setAttribute(\"data-value\", val)\n if getClickHandler?\n td.onclick = getClickHandler(val, [], [])\n tr.appendChild td\n return tr\n return fn[element]()\n\n\n makeClickHandler = (opts) ->\n if opts.table.clickCallback\n getClickHandler = (value, rowValues, colValues) ->\n filters = {}\n for own i, attr of colAttrs\n if colValues[i]?\n filters[attr] = colValues[i]\n for own j , attr of rowAttrs\n if rowValues[j]?\n filters[attr] = rowValues[j]\n return (e) ->\n return opts.table.clickCallback(e, value, filters, pivotData)\n return getClickHandler\n\n getExtendedOpts = (opts, type) ->\n defaults =\n table:\n clickCallback: null\n rowTotals: true\n colTotals: true\n localeStrings: \n totals: \"Totals\"\n type: type\n return $.extend(true, {}, defaults, opts)\n\n\n pivotTableRenderer = (pivotData, opts) ->\n colAttrs = pivotData.colAttrs\n rowAttrs = pivotData.rowAttrs \n rowKeys = pivotData.getRowKeys()\n colKeys = pivotData.getColKeys()\n rowLimit = if pivotData.getRowLimit() > 0 then pivotData.getRowLimit() else rowKeys.length\n colLimit = if pivotData.getColLimit() > 0 then pivotData.getColLimit() else colKeys.length\n rowStart = 0\n colStart = 0\n colEnd = colStart + colLimit\n rowEnd = rowStart + rowLimit\n grandTotalFlag = false\n colTotalFlag = false\n rowTotalFlag = false\n result = document.createElement(\"table\")\n result.className = \"pvtTable\"\n result.setAttribute(\"data-numrows\", colEnd)\n result.setAttribute(\"data-numcols\", rowEnd)\n createPivotChild = elementAppend(pivotData, opts)\n scrollevent = new ScrollEvent(pivotData, opts)\n scrollevent.addRenderEvent()\n\n # thead\n thead = document.createElement(\"thead\")\n for own j, c of colAttrs\n tr = document.createElement(\"tr\")\n if (parseInt(j) == 0 && rowAttrs.length != 0)\n th = document.createElement(\"th\")\n th.setAttribute(\"colspan\", rowAttrs.length)\n th.setAttribute(\"rowspan\", colAttrs.length)\n tr.appendChild(th)\n th = document.createElement(\"th\")\n th.className = \"pvtAxisLabel\"\n th.textContent = c\n tr.appendChild th\n createPivotChild('thead-th', rowStart, rowEnd, colStart, colEnd, parseInt(j), tr)\n thead.appendChild tr\n\n createPivotChild('thead-th-total', rowStart, rowEnd, colStart, colEnd, null, thead)\n result.appendChild thead\n\n # tbody\n tbody = document.createElement(\"tbody\")\n for own i, rowKey of rowKeys.slice(rowStart, rowEnd)\n tr = document.createElement(\"tr\")\n createPivotChild('tbody-th', rowStart, rowEnd, colStart, colEnd, parseInt(i), tr)\n createPivotChild('tbody-td', rowStart, rowEnd, colStart, colEnd, parseInt(i), tr)\n tbody.appendChild tr\n createPivotChild('col-total-th', rowStart, rowEnd, colStart, colEnd, null, tbody)\n result.appendChild tbody\n\n return result\n\n $.pivotUtilities.hot_renderes =\n renderer:\n 'Table': (data, opts) ->\n extendedOpts = getExtendedOpts(opts, 'Table')\n return pivotTableRenderer(data, extendedOpts)\n 'Heatmap': (data, opts) ->\n extendedOpts = getExtendedOpts(opts, 'Heatmap')\n return $(pivotTableRenderer(data, extendedOpts)).heatmap(\"heatmap\", extendedOpts)\n removeScrollevent: () ->\n if scrollevent\n return scrollevent.removeRenderEvent()\n"]} \ No newline at end of file diff --git a/dist/hot_renderers.min.js b/dist/hot_renderers.min.js new file mode 100644 index 00000000..ae7b464b --- /dev/null +++ b/dist/hot_renderers.min.js @@ -0,0 +1,2 @@ +(function(){var t,e={}.hasOwnProperty,n=function(t,e){return function(){return t.apply(e,arguments)}};(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 r,o,l,a,d,c,s,u,h,p,m,v,f,g,b,w,E,y,C,A;return h={}.hasOwnProperty,l=99,b=99,w=0,a=0,o=a+l,g=w+b,C=!1,u=!1,d=!1,E=!1,p=function(t,e,n){return 0===n?-1:t[n][e-1]===t[n-1][e-1]&&t[n][e]===t[n-1][e]?1:-1},y=function(n,r){return function(){var d,s,u,h,p,m,v,f;if(m=this.scrollWidth,p=this.scrollLeft+this.offsetWidth,d=n.colAttrs,h=n.getRowKeys(),u=document.getElementsByClassName("pvtTable").item(0),s=c(n,r),!E&&(p-m<0||p-m===1)&&(a=o,o=a+l,f=u.getElementsByTagName("thead").item(0).childNodes,f.forEach(node,i)(function(){var t,n,r;r=[];for(n in d)e.call(d,n)&&(t=d[n],parseInt(i)===parseInt(n)?r.push(s("thead-th",w,g,a,o,parseInt(n),node)):r.push(void 0));return r}),v=u.getElementsByTagName("tbody").item(0).childNodes,v.forEach(node,i)(function(){var t,e,n,r;for(r=[],t=e=0,n=g;0<=n?e<=n:e>=n;t=0<=n?++e:--e)parseInt(i)===parseInt(t)?i>=h.length?r.push(s("col-total-td",w,g,a,o,null,node)):r.push(s("tbody-td",w,g,a,o,parseInt(t),node)):r.push(void 0);return r}),"Heatmap"===r.type))return t(u).heatmap("heatmap",r)}},A=function(n,r){return function(){var l,i,s,u,h,p,m,v,f,E;if(m=t(document).height(),v=t(window).height()+t(window).scrollTop(),(m-v)/m===0&&(p=n.getRowKeys(),u=document.getElementsByClassName("pvtTable").item(0),f=u.getElementsByTagName("tbody").item(0),l=c(n,r),!d)){w=g,g=w+b,s=p.slice(w,g);for(i in s)e.call(s,i)&&(h=s[i],E=document.createElement("tr"),l("tbody-th",w,g,a,o,parseInt(i),E),l("tbody-td",w,g,a,o,parseInt(i),E),f.appendChild(E));if(l("col-total-th",w,g,a,o,null,f),"Heatmap"===r.type)return t(u).heatmap("heatmap",r)}}},m=function(t,e,n){if("PageDown"===t.code&&A(e,n),"end"===t.code&&A(e,n),"ArrowDown"===t.ecode)return A(e,n)},r=function(){function t(t,e){null==e&&(e={}),this.removeRenderEvent=n(this.removeRenderEvent,this),this.addRenderEvent=n(this.addRenderEvent,this),this.fn={rowrender:A(t,e),colrender:y(t,e),keydownend:function(n){return m(n,t,e)}},this.getKeydownendEvent=function(){return this.fn.keydownend},this.getRowrenderEvent=function(){return this.fn.rowrender},this.getColRenderEvent=function(t){return function(){return t.fn.colrender}}(this)}return t.prototype.addRenderEvent=function(){return window.addEventListener("scroll",this.getRowrenderEvent()),window.addEventListener("keydown",this.getKeydownendEvent()),document.getElementById("output").addEventListener("scroll",this.getColRenderEvent())},t.prototype.removeRenderEvent=function(){return window.removeEventListener("scroll",this.getRowRenderEvent()),window.removeEventListener("keydown",this.getKeydownendEvent()),document.getElementById("output").removeEventListener("scroll",this.getColRenderEvent())},t}(),c=function(t,n){var r,o,l,a,i;return r=t.colAttrs,a=t.rowAttrs,i=t.getRowKeys(),o=t.getColKeys(),l=v(n),function(c,s,m,v,f,g,b){var w;return w={"thead-th":function(){var t,l,d,i,c;d=o.slice(v,f);for(l in d)e.call(d,l)&&(t=d[l],c=p(o,parseInt(g),parseInt(l)),i=document.createElement("th"),i.className="pvtColLabel",c===-1?(i.textContent=t[g],i.setAttribute("style","border-right:none;")):i.setAttribute("style","border-left:none;border-right:none;"),parseInt(g)===r.length-1&&0!==a.length&&i.setAttribute("rowspan",2),b.appendChild(i),parseInt(l)!==o.length-1||E||0===parseInt(g)&&n.table.rowTotals&&(i=document.createElement("th"),i.className="pvtTotalLabel pvtRowTotalLabel",i.innerHTML=n.localeStrings.totals,i.setAttribute("rowspan",r.length+(0===a.length?0:1)),b.appendChild(i)));return b},"thead-th-total":function(){var t,o,l;if(0!==a.length){l=document.createElement("tr");for(g in a)e.call(a,g)&&(t=a[g],o=document.createElement("th"),o.className="pvtAxisLabel",o.textContent=t,l.appendChild(o));o=document.createElement("th"),0===r.length&&(o.className="pvtTotalLabel pvtRowTotalLabel",o.innerHTML=n.localeStrings.totals),l.appendChild(o),b.appendChild(l)}return b},"tbody-th":function(){var t,n,o,l,d;n=i[g];for(t in n)e.call(n,t)&&(l=n[t],o=document.createElement("th"),o.className="pvtRowLabel",d=p(i,parseInt(t),parseInt(g)),d===-1?(o.textContent=l,o.setAttribute("style","border-bottom:none;")):o.setAttribute("style","border-bottom:none;border-top:none;"),parseInt(t)===a.length-1&&0!==r.length&&o.setAttribute("colspan",2),b.appendChild(o));return b},"tbody-td":function(){var n,r,a,d,c,s,u;c=i[g],d=o.slice(v,f);for(a in d)e.call(d,a)&&(r=d[a],r=o[a],n=t.getAggregator(c,r),u=n.value(),s=document.createElement("td"),s.className="pvtVal row"+g+" col"+a,s.textContent=n.format(u),s.setAttribute("data-value",u),null!=l&&(s.onclick=l(u,c,r)),b.appendChild(s));return this["row-total-td"](),b},"row-total-td":function(){var e,a,d,c;return e=i[g],f>=o.length&&(n.table.rowTotals||0===r.length)&&(E=!0,d=t.getAggregator(e,[]),c=d.value(),a=document.createElement("td"),a.className="pvtTotal rowTotal",a.textContent=d.format(c),a.setAttribute("data-value",c),null!=l&&(a.onclick=l(c,e,[])),a.setAttribute("data-for","row"+g),b.appendChild(a)),b},"col-total-th":function(t){var e;return t=t||document.createElement("tr"),m>i.length&&!d&&(n.table.colTotals||0===a.length)&&(d=!0,e=document.createElement("th"),e.className="pvtTotalLabel pvtColTotalLabel",e.innerHTML=n.localeStrings.totals,e.setAttribute("colspan",a.length+(0===r.length?0:1)),t.appendChild(e),this["col-total-td"](t),b.appendChild(t)),b},"col-total-td":function(e){var n,a,d,i,c,s,u,p;for(e=e||b,0===r.length&&this["grand-total-td"](e),a=d=i=v,c=f;i<=c?d<=c:d>=c;a=i<=c?++d:--d)h.call(o,a)&&(n=o[a],u=t.getAggregator([],n),p=u.value(),s=document.createElement("td"),s.className="pvtTotal colTotal",s.textContent=u.format(p),s.setAttribute("data-value",p),null!=l&&(s.onclick=l(p,[],n)),s.setAttribute("data-for","col"+a),e.appendChild(s),o.length-1===a&&this["grand-total-td"](e));return e},"grand-total-td":function(e){var o,a,d;return!n.table.rowTotals&&0!==r.length&&u||(u=!0,a=t.getAggregator([],[]),d=a.value(),o=document.createElement("td"),o.className="pvtGrandTotal",o.textContent=a.format(d),o.setAttribute("data-value",d),null!=l&&(o.onclick=l(d,[],[])),e.appendChild(o)),e}},w[c]()}},v=function(t){var n;return t.table.clickCallback&&(n=function(n,r,o){var l,a,d,i;a={};for(d in colAttrs)e.call(colAttrs,d)&&(l=colAttrs[d],null!=o[d]&&(a[l]=o[d]));for(i in rowAttrs)e.call(rowAttrs,i)&&(l=rowAttrs[i],null!=r[i]&&(a[l]=r[i]));return function(e){return t.table.clickCallback(e,n,a,pivotData)}}),n},s=function(e,n){var r;return r={table:{clickCallback:null,rowTotals:!0,colTotals:!0},localeStrings:{totals:"Totals"},type:n},t.extend(!0,{},r,e)},f=function(t,n){var i,s,h,p,m,v,f,y,C,A,T,L,R,I,N,k;s=t.colAttrs,C=t.rowAttrs,T=t.getRowKeys(),h=t.getColKeys(),b=t.getRowLimit()>0?t.getRowLimit():T.length,l=t.getColLimit()>0?t.getColLimit():h.length,w=0,a=0,o=a+l,g=w+b,u=!1,d=!1,E=!1,y=document.createElement("table"),y.className="pvtTable",y.setAttribute("data-numrows",o),y.setAttribute("data-numcols",g),p=c(t,n),L=new r(t,n),L.addRenderEvent(),N=document.createElement("thead");for(v in s)e.call(s,v)&&(i=s[v],k=document.createElement("tr"),0===parseInt(v)&&0!==C.length&&(I=document.createElement("th"),I.setAttribute("colspan",C.length),I.setAttribute("rowspan",s.length),k.appendChild(I)),I=document.createElement("th"),I.className="pvtAxisLabel",I.textContent=i,k.appendChild(I),p("thead-th",w,g,a,o,parseInt(v),k),N.appendChild(k));p("thead-th-total",w,g,a,o,null,N),y.appendChild(N),R=document.createElement("tbody"),f=T.slice(w,g);for(m in f)e.call(f,m)&&(A=f[m],k=document.createElement("tr"),p("tbody-th",w,g,a,o,parseInt(m),k),p("tbody-td",w,g,a,o,parseInt(m),k),R.appendChild(k));return p("col-total-th",w,g,a,o,null,R),y.appendChild(R),y},t.pivotUtilities.hot_renderes={renderer:{Table:function(t,e){var n;return n=s(e,"Table"),f(t,n)},Heatmap:function(e,n){var r;return r=s(n,"Heatmap"),t(f(e,r)).heatmap("heatmap",r)}},removeScrollevent:function(){if(scrollevent)return scrollevent.removeRenderEvent()}}})}).call(this); +//# sourceMappingURL=hot_renderers.min.js.map diff --git a/dist/hot_renderers.min.js.map b/dist/hot_renderers.min.js.map new file mode 100644 index 00000000..ee2909f4 --- /dev/null +++ b/dist/hot_renderers.min.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["hot_renderers.coffee","hot_renderers.min.js"],"names":["callWithJQuery","hasProp1","hasOwnProperty","bind","fn","me","apply","arguments","pivotModule","exports","module","require","define","amd","jQuery","$","ScrollEvent","colEnd","colLimit","colStart","colTotalFlag","elementAppend","getExtendedOpts","grandTotalFlag","hasProp","isOverlap","keydownendEvent","makeClickHandler","pivotTableRenderer","rowEnd","rowLimit","rowStart","rowTotalFlag","scrollColrender","scrollDown","scrollRowrender","arr","i","j","pivotData","opts","colAttrs","createPivotChild","result","rowKeys","scrollPositionX","scrollWidth","tbodyChildNodes","theadChildNodes","this","scrollLeft","offsetWidth","getRowKeys","document","getElementsByClassName","item","getElementsByTagName","childNodes","forEach","node","colAttr","results","call","parseInt","push","k","ref","length","type","heatmap","rowKey","scrollHeight","scrollPositionY","tbody","tr","height","window","scrollTop","slice","createElement","appendChild","e","code","ecode","removeRenderEvent","addRenderEvent","rowrender","colrender","keydownend","event","getKeydownendEvent","getRowrenderEvent","getColRenderEvent","_this","prototype","addEventListener","getElementById","removeEventListener","getRowRenderEvent","colKeys","getClickHandler","rowAttrs","getColKeys","element","target","thead-th","colKey","th","x","className","textContent","setAttribute","table","rowTotals","innerHTML","localeStrings","totals","thead-th-total","r","tbody-th","txt","tbody-td","aggregator","td","val","getAggregator","value","format","onclick","row-total-td","totalAggregator","col-total-th","colTotals","col-total-td","ref1","grand-total-td","clickCallback","rowValues","colValues","attr","filters","defaults","extend","c","scrollevent","thead","getRowLimit","getColLimit","pivotUtilities","hot_renderes","renderer","Table","data","extendedOpts","Heatmap","removeScrollevent"],"mappings":"CAAA,WAAA,GAAAA,GAAAC,KAAAC,eCGIC,EAAO,SAASC,EAAIC,GAAK,MAAO,YAAY,MAAOD,GAAGE,MAAMD,EAAIE,cDHpEP,EAAiB,SAACQ,GACd,MAAqB,gBAAXC,UAAyC,gBAAVC,QACrCF,EAAYG,QAAQ,WACC,kBAAVC,SAAyBA,OAAOC,IAC3CD,QAAQ,UAAWJ,GAGnBA,EAAYM,UAEL,SAACC,GACZ,GAAAC,GAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,CCucA,ODvcAX,MAAatB,eACbgB,EAAW,GACXY,EAAW,GACXC,EAAW,EACXZ,EAAW,EACXF,EAASE,EAAWD,EACpBW,EAASE,EAAWD,EACpBI,GAAa,EACbX,GAAiB,EACjBH,GAAe,EACfY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nBA,EAAKtD,SAAS0B,cAAc,MAC5B4B,EAAGE,UAAY,eACfF,EAAGG,YAAciC,EACjBrE,EAAGM,YAAY2B,GACfjE,EAAiB,WAAYX,EAAUF,EAAQV,EAAUF,EAAQ8C,SAASzB,GAAIoC,GAC9EuE,EAAMjE,YAAYN,GAEtBhC,GAAiB,iBAAkBX,EAAUF,EAAQV,EAAUF,EAAQ,KAAMgI,GAC7EtG,EAAOqC,YAAYiE,GAGnBxE,EAAQpB,SAAS0B,cAAc,SAC/Bb,EAAAtB,EAAAkC,MAAA/C,EAAAF,EAAA,KAAAQ,IAAA6B,GCqHKjE,EAAS6D,KAAKI,EAAK7B,KACxBiC,EAASJ,EAAI7B,GDrHTqC,EAAKrB,SAAS0B,cAAc,MAC5BrC,EAAiB,WAAYX,EAAUF,EAAQV,EAAUF,EAAQ8C,SAAS1B,GAAIqC,GAC9EhC,EAAiB,WAAYX,EAAUF,EAAQV,EAAUF,EAAQ8C,SAAS1B,GAAIqC,GAC9ED,EAAMO,YAAYN,GAItB,OAHAhC,GAAiB,eAAgBX,EAAUF,EAAQV,EAAUF,EAAQ,KAAMwD,GAC3E9B,EAAOqC,YAAYP,GAEZ9B,GAEX5B,EAAEqI,eAAeC,cACbC,UACIC,MAAS,SAACC,EAAMhH,GACZ,GAAAiH,EACA,OADAA,GAAenI,EAAgBkB,EAAM,SAC9BZ,EAAmB4H,EAAMC,IACpCC,QAAW,SAACF,EAAMhH,GACd,GAAAiH,EACA,OADAA,GAAenI,EAAgBkB,EAAM,WAC9BzB,EAAEa,EAAmB4H,EAAMC,IAAepF,QAAQ,UAAWoF,KAC5EE,kBAAmB,WACf,GAAGX,YACC,MAAOA,aAAY5D,0BCiIhCtB,KAAKb","file":"hot_renderers.min.js","sourcesContent":["callWithJQuery = (pivotModule) ->\n if typeof exports is \"object\" and typeof module is \"object\" # CommonJS\n pivotModule require(\"jquery\")\n else if typeof define is \"function\" and define.amd # AMD\n define [\"jquery\"], pivotModule\n # Plain browser env\n else\n pivotModule jQuery\n\ncallWithJQuery ($) ->\n hasProp = {}.hasOwnProperty\n colLimit = 99\n rowLimit = 99\n rowStart = 0\n colStart = 0\n colEnd = colStart + colLimit\n rowEnd = rowStart + rowLimit\n scrollDown = false\n grandTotalFlag = false\n colTotalFlag = false\n rowTotalFlag = false\n\n isOverlap = (arr, i, j) ->\n if j == 0\n return -1\n if arr[j][i-1] == arr[j-1][i-1] && arr[j][i] == arr[j-1][i]\n return 1\n return -1 \n \n\n scrollColrender = (pivotData, opts) ->\n return () ->\n scrollWidth = this.scrollWidth;\n scrollPositionX = this.scrollLeft + this.offsetWidth\n colAttrs = pivotData.colAttrs\n rowKeys = pivotData.getRowKeys()\n result = document.getElementsByClassName('pvtTable').item(0)\n createPivotChild = elementAppend(pivotData, opts)\n\n if !rowTotalFlag && (((scrollPositionX - scrollWidth) < 0) || (scrollPositionX - scrollWidth) == 1)\n colStart = colEnd\n colEnd = colStart + colLimit\n theadChildNodes = result.getElementsByTagName('thead').item(0).childNodes\n theadChildNodes.forEach(node, i) ->\n for own j, colAttr of colAttrs\n if parseInt(i) == parseInt(j)\n createPivotChild('thead-th', rowStart, rowEnd, colStart, colEnd, parseInt(j), node)\n \n \n tbodyChildNodes = result.getElementsByTagName('tbody').item(0).childNodes\n tbodyChildNodes.forEach(node, i) ->\n for j in [0..rowEnd]\n if parseInt(i) == parseInt(j) \n if i >= rowKeys.length\n createPivotChild('col-total-td', rowStart, rowEnd, colStart, colEnd, null, node)\n else \n createPivotChild('tbody-td', rowStart, rowEnd, colStart, colEnd, parseInt(j), node)\n if opts.type == 'Heatmap'\n $(result).heatmap(\"heatmap\", opts)\n\n scrollRowrender = (pivotData, opts) ->\n return () ->\n scrollHeight = $(document).height()\n scrollPositionY = $(window).height() + $(window).scrollTop()\n if (scrollHeight - scrollPositionY) / scrollHeight == 0\n rowKeys = pivotData.getRowKeys()\n result = document.getElementsByClassName('pvtTable').item(0)\n tbody = result.getElementsByTagName('tbody').item(0)\n createPivotChild = elementAppend(pivotData, opts)\n if !colTotalFlag\n rowStart = rowEnd\n rowEnd = rowStart + rowLimit\n for own i, rowKey of rowKeys.slice(rowStart, rowEnd)\n tr = document.createElement(\"tr\")\n createPivotChild('tbody-th', rowStart, rowEnd, colStart, colEnd, parseInt(i), tr)\n createPivotChild('tbody-td', rowStart, rowEnd, colStart, colEnd, parseInt(i), tr)\n tbody.appendChild(tr)\n createPivotChild('col-total-th', rowStart, rowEnd, colStart, colEnd, null, tbody)\n if opts.type == 'Heatmap'\n $(result).heatmap(\"heatmap\", opts)\n\n\n keydownendEvent = (e, pivotData, opts) ->\n if e.code == 'PageDown'\n scrollRowrender(pivotData, opts)\n if e.code == 'end'\n scrollRowrender(pivotData, opts)\n if e.ecode == 'ArrowDown'\n scrollRowrender(pivotData, opts) \n\n \n ###\n Scroll Event Class\n ###\n \n class ScrollEvent\n constructor: (pivotData, opts = {}) ->\n @fn = \n rowrender: scrollRowrender(pivotData, opts)\n colrender: scrollColrender(pivotData, opts)\n keydownend: (event) ->\n return keydownendEvent(event, pivotData, opts)\n\n @getKeydownendEvent = () ->\n return @fn.keydownend\n \n @getRowrenderEvent = () ->\n return @fn.rowrender\n \n @getColRenderEvent = () =>\n return @fn.colrender\n addRenderEvent: () =>\n window.addEventListener('scroll', @getRowrenderEvent())\n window.addEventListener('keydown', @getKeydownendEvent())\n document.getElementById('output').addEventListener('scroll', @getColRenderEvent())\n removeRenderEvent: () =>\n window.removeEventListener('scroll', @getRowRenderEvent())\n window.removeEventListener('keydown', @getKeydownendEvent())\n document.getElementById('output').removeEventListener('scroll', @getColRenderEvent())\n\n\n elementAppend = (pivotData, opts) ->\n colAttrs = pivotData.colAttrs\n rowAttrs = pivotData.rowAttrs\n rowKeys = pivotData.getRowKeys()\n colKeys = pivotData.getColKeys()\n getClickHandler = makeClickHandler(opts)\n return (element, rowStart, rowEnd, colStart, colEnd, i, target) ->\n fn = \n 'thead-th': () ->\n for own j, colKey of colKeys.slice(colStart, colEnd)\n x = isOverlap(colKeys, parseInt(i), parseInt(j))\n th = document.createElement(\"th\")\n th.className = \"pvtColLabel\"\n if x == -1\n th.textContent = colKey[i]\n th.setAttribute('style', 'border-right:none;')\n else\n th.setAttribute('style', 'border-left:none;border-right:none;')\n \n if (parseInt(i) == colAttrs.length-1 && rowAttrs.length != 0)\n th.setAttribute(\"rowspan\", 2)\n target.appendChild th\n\n if (parseInt(j) == colKeys.length-1 && !rowTotalFlag)\n if parseInt(i) == 0 && opts.table.rowTotals\n th = document.createElement(\"th\")\n th.className = \"pvtTotalLabel pvtRowTotalLabel\"\n th.innerHTML = opts.localeStrings.totals\n th.setAttribute(\"rowspan\", colAttrs.length + (if rowAttrs.length == 0 then 0 else 1))\n target.appendChild th\n return target\n 'thead-th-total': () ->\n # pvtAxisLabel\n if rowAttrs.length != 0\n tr = document.createElement(\"tr\")\n for own i, r of rowAttrs\n # r = rowAttrs[i]\n th = document.createElement(\"th\")\n th.className = \"pvtAxisLabel\"\n th.textContent = r\n tr.appendChild th\n th = document.createElement(\"th\")\n if colAttrs.length == 0\n # th.setAttribute(\"rowspan\", 2)\n th.className = \"pvtTotalLabel pvtRowTotalLabel\"\n th.innerHTML = opts.localeStrings.totals\n tr.appendChild th\n target.appendChild tr\n return target\n 'tbody-th': () ->\n rowKey = rowKeys[i]\n # tbody tr th\n for own j, txt of rowKey\n th = document.createElement(\"th\")\n th.className = \"pvtRowLabel\"\n x = isOverlap(rowKeys, parseInt(j), parseInt(i))\n if x == -1\n th.textContent = txt\n th.setAttribute('style', 'border-bottom:none;')\n else\n th.setAttribute('style', 'border-bottom:none;border-top:none;')\n if parseInt(j) == rowAttrs.length-1 && colAttrs.length != 0\n th.setAttribute(\"colspan\", 2)\n target.appendChild th\n return target\n 'tbody-td': () -> \n # tbody tr td\n rowKey = rowKeys[i]\n for own j, colKey of colKeys.slice(colStart, colEnd)\n colKey = colKeys[j]\n aggregator = pivotData.getAggregator(rowKey, colKey)\n val = aggregator.value()\n td = document.createElement(\"td\")\n td.className = \"pvtVal row\" + i + \" col\" + j\n td.textContent = aggregator.format(val)\n td.setAttribute(\"data-value\", val)\n if getClickHandler?\n td.onclick = getClickHandler(val, rowKey, colKey)\n target.appendChild td\n this['row-total-td']()\n return target\n 'row-total-td': () ->\n # col Total\n rowKey = rowKeys[i]\n if colEnd >= colKeys.length\n if (opts.table.rowTotals || colAttrs.length == 0)\n rowTotalFlag = true\n totalAggregator = pivotData.getAggregator(rowKey, [])\n val = totalAggregator.value()\n td = document.createElement(\"td\")\n td.className = \"pvtTotal rowTotal\"\n td.textContent = totalAggregator.format(val)\n td.setAttribute(\"data-value\", val)\n if getClickHandler?\n td.onclick = getClickHandler(val, rowKey, [])\n td.setAttribute(\"data-for\", \"row\" + i)\n target.appendChild td\n return target\n 'col-total-th': (tr) ->\n tr = tr || document.createElement(\"tr\")\n if rowEnd > rowKeys.length && !colTotalFlag\n if opts.table.colTotals || rowAttrs.length == 0\n colTotalFlag = true\n th = document.createElement(\"th\")\n th.className = \"pvtTotalLabel pvtColTotalLabel\"\n th.innerHTML = opts.localeStrings.totals\n th.setAttribute(\"colspan\", rowAttrs.length + (if colAttrs.length == 0 then 0 else 1))\n tr.appendChild th\n this['col-total-td'](tr)\n target.appendChild tr\n return target\n 'col-total-td': (tr) ->\n tr = tr || target\n if colAttrs.length == 0 \n this['grand-total-td'](tr)\n for j in [colStart..colEnd]\n if hasProp.call(colKeys, j)\n colKey = colKeys[j]\n totalAggregator = pivotData.getAggregator([], colKey)\n val = totalAggregator.value()\n td = document.createElement(\"td\")\n td.className = \"pvtTotal colTotal\"\n td.textContent = totalAggregator.format(val)\n td.setAttribute(\"data-value\", val)\n if getClickHandler?\n td.onclick = getClickHandler(val, [], colKey)\n td.setAttribute(\"data-for\", \"col\" + j)\n tr.appendChild td\n if colKeys.length - 1 == j\n this['grand-total-td'](tr)\n return tr\n 'grand-total-td': (tr) ->\n if ((opts.table.rowTotals || colAttrs.length == 0) || !grandTotalFlag)\n grandTotalFlag = true\n totalAggregator = pivotData.getAggregator([], [])\n val = totalAggregator.value()\n td = document.createElement(\"td\")\n td.className = \"pvtGrandTotal\"\n td.textContent = totalAggregator.format(val)\n td.setAttribute(\"data-value\", val)\n if getClickHandler?\n td.onclick = getClickHandler(val, [], [])\n tr.appendChild td\n return tr\n return fn[element]()\n\n\n makeClickHandler = (opts) ->\n if opts.table.clickCallback\n getClickHandler = (value, rowValues, colValues) ->\n filters = {}\n for own i, attr of colAttrs\n if colValues[i]?\n filters[attr] = colValues[i]\n for own j , attr of rowAttrs\n if rowValues[j]?\n filters[attr] = rowValues[j]\n return (e) ->\n return opts.table.clickCallback(e, value, filters, pivotData)\n return getClickHandler\n\n getExtendedOpts = (opts, type) ->\n defaults =\n table:\n clickCallback: null\n rowTotals: true\n colTotals: true\n localeStrings: \n totals: \"Totals\"\n type: type\n return $.extend(true, {}, defaults, opts)\n\n\n pivotTableRenderer = (pivotData, opts) ->\n colAttrs = pivotData.colAttrs\n rowAttrs = pivotData.rowAttrs \n rowKeys = pivotData.getRowKeys()\n colKeys = pivotData.getColKeys()\n rowLimit = if pivotData.getRowLimit() > 0 then pivotData.getRowLimit() else rowKeys.length\n colLimit = if pivotData.getColLimit() > 0 then pivotData.getColLimit() else colKeys.length\n rowStart = 0\n colStart = 0\n colEnd = colStart + colLimit\n rowEnd = rowStart + rowLimit\n grandTotalFlag = false\n colTotalFlag = false\n rowTotalFlag = false\n result = document.createElement(\"table\")\n result.className = \"pvtTable\"\n result.setAttribute(\"data-numrows\", colEnd)\n result.setAttribute(\"data-numcols\", rowEnd)\n createPivotChild = elementAppend(pivotData, opts)\n scrollevent = new ScrollEvent(pivotData, opts)\n scrollevent.addRenderEvent()\n\n # thead\n thead = document.createElement(\"thead\")\n for own j, c of colAttrs\n tr = document.createElement(\"tr\")\n if (parseInt(j) == 0 && rowAttrs.length != 0)\n th = document.createElement(\"th\")\n th.setAttribute(\"colspan\", rowAttrs.length)\n th.setAttribute(\"rowspan\", colAttrs.length)\n tr.appendChild(th)\n th = document.createElement(\"th\")\n th.className = \"pvtAxisLabel\"\n th.textContent = c\n tr.appendChild th\n createPivotChild('thead-th', rowStart, rowEnd, colStart, colEnd, parseInt(j), tr)\n thead.appendChild tr\n\n createPivotChild('thead-th-total', rowStart, rowEnd, colStart, colEnd, null, thead)\n result.appendChild thead\n\n # tbody\n tbody = document.createElement(\"tbody\")\n for own i, rowKey of rowKeys.slice(rowStart, rowEnd)\n tr = document.createElement(\"tr\")\n createPivotChild('tbody-th', rowStart, rowEnd, colStart, colEnd, parseInt(i), tr)\n createPivotChild('tbody-td', rowStart, rowEnd, colStart, colEnd, parseInt(i), tr)\n tbody.appendChild tr\n createPivotChild('col-total-th', rowStart, rowEnd, colStart, colEnd, null, tbody)\n result.appendChild tbody\n\n return result\n\n $.pivotUtilities.hot_renderes =\n renderer:\n 'Table': (data, opts) ->\n extendedOpts = getExtendedOpts(opts, 'Table')\n return pivotTableRenderer(data, extendedOpts)\n 'Heatmap': (data, opts) ->\n extendedOpts = getExtendedOpts(opts, 'Heatmap')\n return $(pivotTableRenderer(data, extendedOpts)).heatmap(\"heatmap\", extendedOpts)\n removeScrollevent: () ->\n if scrollevent\n return scrollevent.removeRenderEvent()\n","(function() {\n var callWithJQuery,\n hasProp1 = {}.hasOwnProperty,\n bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };\n\n callWithJQuery = function(pivotModule) {\n if (typeof exports === \"object\" && typeof module === \"object\") {\n return pivotModule(require(\"jquery\"));\n } else if (typeof define === \"function\" && define.amd) {\n return define([\"jquery\"], pivotModule);\n } else {\n return pivotModule(jQuery);\n }\n };\n\n callWithJQuery(function($) {\n var ScrollEvent, colEnd, colLimit, colStart, colTotalFlag, elementAppend, getExtendedOpts, grandTotalFlag, hasProp, isOverlap, keydownendEvent, makeClickHandler, pivotTableRenderer, rowEnd, rowLimit, rowStart, rowTotalFlag, scrollColrender, scrollDown, scrollRowrender;\n hasProp = {}.hasOwnProperty;\n colLimit = 99;\n rowLimit = 99;\n rowStart = 0;\n colStart = 0;\n colEnd = colStart + colLimit;\n rowEnd = rowStart + rowLimit;\n scrollDown = false;\n grandTotalFlag = false;\n colTotalFlag = false;\n rowTotalFlag = false;\n isOverlap = function(arr, i, j) {\n if (j === 0) {\n return -1;\n }\n if (arr[j][i - 1] === arr[j - 1][i - 1] && arr[j][i] === arr[j - 1][i]) {\n return 1;\n }\n return -1;\n };\n scrollColrender = function(pivotData, opts) {\n return function() {\n var colAttrs, createPivotChild, result, rowKeys, scrollPositionX, scrollWidth, tbodyChildNodes, theadChildNodes;\n scrollWidth = this.scrollWidth;\n scrollPositionX = this.scrollLeft + this.offsetWidth;\n colAttrs = pivotData.colAttrs;\n rowKeys = pivotData.getRowKeys();\n result = document.getElementsByClassName('pvtTable').item(0);\n createPivotChild = elementAppend(pivotData, opts);\n if (!rowTotalFlag && (((scrollPositionX - scrollWidth) < 0) || (scrollPositionX - scrollWidth) === 1)) {\n colStart = colEnd;\n colEnd = colStart + colLimit;\n theadChildNodes = result.getElementsByTagName('thead').item(0).childNodes;\n theadChildNodes.forEach(node, i)(function() {\n var colAttr, j, results;\n results = [];\n for (j in colAttrs) {\n if (!hasProp1.call(colAttrs, j)) continue;\n colAttr = colAttrs[j];\n if (parseInt(i) === parseInt(j)) {\n results.push(createPivotChild('thead-th', rowStart, rowEnd, colStart, colEnd, parseInt(j), node));\n } else {\n results.push(void 0);\n }\n }\n return results;\n });\n tbodyChildNodes = result.getElementsByTagName('tbody').item(0).childNodes;\n tbodyChildNodes.forEach(node, i)(function() {\n var j, k, ref, results;\n results = [];\n for (j = k = 0, ref = rowEnd; 0 <= ref ? k <= ref : k >= ref; j = 0 <= ref ? ++k : --k) {\n if (parseInt(i) === parseInt(j)) {\n if (i >= rowKeys.length) {\n results.push(createPivotChild('col-total-td', rowStart, rowEnd, colStart, colEnd, null, node));\n } else {\n results.push(createPivotChild('tbody-td', rowStart, rowEnd, colStart, colEnd, parseInt(j), node));\n }\n } else {\n results.push(void 0);\n }\n }\n return results;\n });\n if (opts.type === 'Heatmap') {\n return $(result).heatmap(\"heatmap\", opts);\n }\n }\n };\n };\n scrollRowrender = function(pivotData, opts) {\n return function() {\n var createPivotChild, i, ref, result, rowKey, rowKeys, scrollHeight, scrollPositionY, tbody, tr;\n scrollHeight = $(document).height();\n scrollPositionY = $(window).height() + $(window).scrollTop();\n if ((scrollHeight - scrollPositionY) / scrollHeight === 0) {\n rowKeys = pivotData.getRowKeys();\n result = document.getElementsByClassName('pvtTable').item(0);\n tbody = result.getElementsByTagName('tbody').item(0);\n createPivotChild = elementAppend(pivotData, opts);\n if (!colTotalFlag) {\n rowStart = rowEnd;\n rowEnd = rowStart + rowLimit;\n ref = rowKeys.slice(rowStart, rowEnd);\n for (i in ref) {\n if (!hasProp1.call(ref, i)) continue;\n rowKey = ref[i];\n tr = document.createElement(\"tr\");\n createPivotChild('tbody-th', rowStart, rowEnd, colStart, colEnd, parseInt(i), tr);\n createPivotChild('tbody-td', rowStart, rowEnd, colStart, colEnd, parseInt(i), tr);\n tbody.appendChild(tr);\n }\n createPivotChild('col-total-th', rowStart, rowEnd, colStart, colEnd, null, tbody);\n if (opts.type === 'Heatmap') {\n return $(result).heatmap(\"heatmap\", opts);\n }\n }\n }\n };\n };\n keydownendEvent = function(e, pivotData, opts) {\n if (e.code === 'PageDown') {\n scrollRowrender(pivotData, opts);\n }\n if (e.code === 'end') {\n scrollRowrender(pivotData, opts);\n }\n if (e.ecode === 'ArrowDown') {\n return scrollRowrender(pivotData, opts);\n }\n };\n\n /*\n Scroll Event Class\n */\n ScrollEvent = (function() {\n function ScrollEvent(pivotData, opts) {\n if (opts == null) {\n opts = {};\n }\n this.removeRenderEvent = bind(this.removeRenderEvent, this);\n this.addRenderEvent = bind(this.addRenderEvent, this);\n this.fn = {\n rowrender: scrollRowrender(pivotData, opts),\n colrender: scrollColrender(pivotData, opts),\n keydownend: function(event) {\n return keydownendEvent(event, pivotData, opts);\n }\n };\n this.getKeydownendEvent = function() {\n return this.fn.keydownend;\n };\n this.getRowrenderEvent = function() {\n return this.fn.rowrender;\n };\n this.getColRenderEvent = (function(_this) {\n return function() {\n return _this.fn.colrender;\n };\n })(this);\n }\n\n ScrollEvent.prototype.addRenderEvent = function() {\n window.addEventListener('scroll', this.getRowrenderEvent());\n window.addEventListener('keydown', this.getKeydownendEvent());\n return document.getElementById('output').addEventListener('scroll', this.getColRenderEvent());\n };\n\n ScrollEvent.prototype.removeRenderEvent = function() {\n window.removeEventListener('scroll', this.getRowRenderEvent());\n window.removeEventListener('keydown', this.getKeydownendEvent());\n return document.getElementById('output').removeEventListener('scroll', this.getColRenderEvent());\n };\n\n return ScrollEvent;\n\n })();\n elementAppend = function(pivotData, opts) {\n var colAttrs, colKeys, getClickHandler, rowAttrs, rowKeys;\n colAttrs = pivotData.colAttrs;\n rowAttrs = pivotData.rowAttrs;\n rowKeys = pivotData.getRowKeys();\n colKeys = pivotData.getColKeys();\n getClickHandler = makeClickHandler(opts);\n return function(element, rowStart, rowEnd, colStart, colEnd, i, target) {\n var fn;\n fn = {\n 'thead-th': function() {\n var colKey, j, ref, th, x;\n ref = colKeys.slice(colStart, colEnd);\n for (j in ref) {\n if (!hasProp1.call(ref, j)) continue;\n colKey = ref[j];\n x = isOverlap(colKeys, parseInt(i), parseInt(j));\n th = document.createElement(\"th\");\n th.className = \"pvtColLabel\";\n if (x === -1) {\n th.textContent = colKey[i];\n th.setAttribute('style', 'border-right:none;');\n } else {\n th.setAttribute('style', 'border-left:none;border-right:none;');\n }\n if (parseInt(i) === colAttrs.length - 1 && rowAttrs.length !== 0) {\n th.setAttribute(\"rowspan\", 2);\n }\n target.appendChild(th);\n if (parseInt(j) === colKeys.length - 1 && !rowTotalFlag) {\n if (parseInt(i) === 0 && opts.table.rowTotals) {\n th = document.createElement(\"th\");\n th.className = \"pvtTotalLabel pvtRowTotalLabel\";\n th.innerHTML = opts.localeStrings.totals;\n th.setAttribute(\"rowspan\", colAttrs.length + (rowAttrs.length === 0 ? 0 : 1));\n target.appendChild(th);\n }\n }\n }\n return target;\n },\n 'thead-th-total': function() {\n var r, th, tr;\n if (rowAttrs.length !== 0) {\n tr = document.createElement(\"tr\");\n for (i in rowAttrs) {\n if (!hasProp1.call(rowAttrs, i)) continue;\n r = rowAttrs[i];\n th = document.createElement(\"th\");\n th.className = \"pvtAxisLabel\";\n th.textContent = r;\n tr.appendChild(th);\n }\n th = document.createElement(\"th\");\n if (colAttrs.length === 0) {\n th.className = \"pvtTotalLabel pvtRowTotalLabel\";\n th.innerHTML = opts.localeStrings.totals;\n }\n tr.appendChild(th);\n target.appendChild(tr);\n }\n return target;\n },\n 'tbody-th': function() {\n var j, rowKey, th, txt, x;\n rowKey = rowKeys[i];\n for (j in rowKey) {\n if (!hasProp1.call(rowKey, j)) continue;\n txt = rowKey[j];\n th = document.createElement(\"th\");\n th.className = \"pvtRowLabel\";\n x = isOverlap(rowKeys, parseInt(j), parseInt(i));\n if (x === -1) {\n th.textContent = txt;\n th.setAttribute('style', 'border-bottom:none;');\n } else {\n th.setAttribute('style', 'border-bottom:none;border-top:none;');\n }\n if (parseInt(j) === rowAttrs.length - 1 && colAttrs.length !== 0) {\n th.setAttribute(\"colspan\", 2);\n }\n target.appendChild(th);\n }\n return target;\n },\n 'tbody-td': function() {\n var aggregator, colKey, j, ref, rowKey, td, val;\n rowKey = rowKeys[i];\n ref = colKeys.slice(colStart, colEnd);\n for (j in ref) {\n if (!hasProp1.call(ref, j)) continue;\n colKey = ref[j];\n colKey = colKeys[j];\n aggregator = pivotData.getAggregator(rowKey, colKey);\n val = aggregator.value();\n td = document.createElement(\"td\");\n td.className = \"pvtVal row\" + i + \" col\" + j;\n td.textContent = aggregator.format(val);\n td.setAttribute(\"data-value\", val);\n if (getClickHandler != null) {\n td.onclick = getClickHandler(val, rowKey, colKey);\n }\n target.appendChild(td);\n }\n this['row-total-td']();\n return target;\n },\n 'row-total-td': function() {\n var rowKey, td, totalAggregator, val;\n rowKey = rowKeys[i];\n if (colEnd >= colKeys.length) {\n if (opts.table.rowTotals || colAttrs.length === 0) {\n rowTotalFlag = true;\n totalAggregator = pivotData.getAggregator(rowKey, []);\n val = totalAggregator.value();\n td = document.createElement(\"td\");\n td.className = \"pvtTotal rowTotal\";\n td.textContent = totalAggregator.format(val);\n td.setAttribute(\"data-value\", val);\n if (getClickHandler != null) {\n td.onclick = getClickHandler(val, rowKey, []);\n }\n td.setAttribute(\"data-for\", \"row\" + i);\n target.appendChild(td);\n }\n }\n return target;\n },\n 'col-total-th': function(tr) {\n var th;\n tr = tr || document.createElement(\"tr\");\n if (rowEnd > rowKeys.length && !colTotalFlag) {\n if (opts.table.colTotals || rowAttrs.length === 0) {\n colTotalFlag = true;\n th = document.createElement(\"th\");\n th.className = \"pvtTotalLabel pvtColTotalLabel\";\n th.innerHTML = opts.localeStrings.totals;\n th.setAttribute(\"colspan\", rowAttrs.length + (colAttrs.length === 0 ? 0 : 1));\n tr.appendChild(th);\n this['col-total-td'](tr);\n target.appendChild(tr);\n }\n }\n return target;\n },\n 'col-total-td': function(tr) {\n var colKey, j, k, ref, ref1, td, totalAggregator, val;\n tr = tr || target;\n if (colAttrs.length === 0) {\n this['grand-total-td'](tr);\n }\n for (j = k = ref = colStart, ref1 = colEnd; ref <= ref1 ? k <= ref1 : k >= ref1; j = ref <= ref1 ? ++k : --k) {\n if (hasProp.call(colKeys, j)) {\n colKey = colKeys[j];\n totalAggregator = pivotData.getAggregator([], colKey);\n val = totalAggregator.value();\n td = document.createElement(\"td\");\n td.className = \"pvtTotal colTotal\";\n td.textContent = totalAggregator.format(val);\n td.setAttribute(\"data-value\", val);\n if (getClickHandler != null) {\n td.onclick = getClickHandler(val, [], colKey);\n }\n td.setAttribute(\"data-for\", \"col\" + j);\n tr.appendChild(td);\n if (colKeys.length - 1 === j) {\n this['grand-total-td'](tr);\n }\n }\n }\n return tr;\n },\n 'grand-total-td': function(tr) {\n var td, totalAggregator, val;\n if ((opts.table.rowTotals || colAttrs.length === 0) || !grandTotalFlag) {\n grandTotalFlag = true;\n totalAggregator = pivotData.getAggregator([], []);\n val = totalAggregator.value();\n td = document.createElement(\"td\");\n td.className = \"pvtGrandTotal\";\n td.textContent = totalAggregator.format(val);\n td.setAttribute(\"data-value\", val);\n if (getClickHandler != null) {\n td.onclick = getClickHandler(val, [], []);\n }\n tr.appendChild(td);\n }\n return tr;\n }\n };\n return fn[element]();\n };\n };\n makeClickHandler = function(opts) {\n var getClickHandler;\n if (opts.table.clickCallback) {\n getClickHandler = function(value, rowValues, colValues) {\n var attr, filters, i, j;\n filters = {};\n for (i in colAttrs) {\n if (!hasProp1.call(colAttrs, i)) continue;\n attr = colAttrs[i];\n if (colValues[i] != null) {\n filters[attr] = colValues[i];\n }\n }\n for (j in rowAttrs) {\n if (!hasProp1.call(rowAttrs, j)) continue;\n attr = rowAttrs[j];\n if (rowValues[j] != null) {\n filters[attr] = rowValues[j];\n }\n }\n return function(e) {\n return opts.table.clickCallback(e, value, filters, pivotData);\n };\n };\n }\n return getClickHandler;\n };\n getExtendedOpts = function(opts, type) {\n var defaults;\n defaults = {\n table: {\n clickCallback: null,\n rowTotals: true,\n colTotals: true\n },\n localeStrings: {\n totals: \"Totals\"\n },\n type: type\n };\n return $.extend(true, {}, defaults, opts);\n };\n pivotTableRenderer = function(pivotData, opts) {\n var c, colAttrs, colKeys, createPivotChild, i, j, ref, result, rowAttrs, rowKey, rowKeys, scrollevent, tbody, th, thead, tr;\n colAttrs = pivotData.colAttrs;\n rowAttrs = pivotData.rowAttrs;\n rowKeys = pivotData.getRowKeys();\n colKeys = pivotData.getColKeys();\n rowLimit = pivotData.getRowLimit() > 0 ? pivotData.getRowLimit() : rowKeys.length;\n colLimit = pivotData.getColLimit() > 0 ? pivotData.getColLimit() : colKeys.length;\n rowStart = 0;\n colStart = 0;\n colEnd = colStart + colLimit;\n rowEnd = rowStart + rowLimit;\n grandTotalFlag = false;\n colTotalFlag = false;\n rowTotalFlag = false;\n result = document.createElement(\"table\");\n result.className = \"pvtTable\";\n result.setAttribute(\"data-numrows\", colEnd);\n result.setAttribute(\"data-numcols\", rowEnd);\n createPivotChild = elementAppend(pivotData, opts);\n scrollevent = new ScrollEvent(pivotData, opts);\n scrollevent.addRenderEvent();\n thead = document.createElement(\"thead\");\n for (j in colAttrs) {\n if (!hasProp1.call(colAttrs, j)) continue;\n c = colAttrs[j];\n tr = document.createElement(\"tr\");\n if (parseInt(j) === 0 && rowAttrs.length !== 0) {\n th = document.createElement(\"th\");\n th.setAttribute(\"colspan\", rowAttrs.length);\n th.setAttribute(\"rowspan\", colAttrs.length);\n tr.appendChild(th);\n }\n th = document.createElement(\"th\");\n th.className = \"pvtAxisLabel\";\n th.textContent = c;\n tr.appendChild(th);\n createPivotChild('thead-th', rowStart, rowEnd, colStart, colEnd, parseInt(j), tr);\n thead.appendChild(tr);\n }\n createPivotChild('thead-th-total', rowStart, rowEnd, colStart, colEnd, null, thead);\n result.appendChild(thead);\n tbody = document.createElement(\"tbody\");\n ref = rowKeys.slice(rowStart, rowEnd);\n for (i in ref) {\n if (!hasProp1.call(ref, i)) continue;\n rowKey = ref[i];\n tr = document.createElement(\"tr\");\n createPivotChild('tbody-th', rowStart, rowEnd, colStart, colEnd, parseInt(i), tr);\n createPivotChild('tbody-td', rowStart, rowEnd, colStart, colEnd, parseInt(i), tr);\n tbody.appendChild(tr);\n }\n createPivotChild('col-total-th', rowStart, rowEnd, colStart, colEnd, null, tbody);\n result.appendChild(tbody);\n return result;\n };\n return $.pivotUtilities.hot_renderes = {\n renderer: {\n 'Table': function(data, opts) {\n var extendedOpts;\n extendedOpts = getExtendedOpts(opts, 'Table');\n return pivotTableRenderer(data, extendedOpts);\n },\n 'Heatmap': function(data, opts) {\n var extendedOpts;\n extendedOpts = getExtendedOpts(opts, 'Heatmap');\n return $(pivotTableRenderer(data, extendedOpts)).heatmap(\"heatmap\", extendedOpts);\n }\n },\n removeScrollevent: function() {\n if (scrollevent) {\n return scrollevent.removeRenderEvent();\n }\n }\n };\n });\n\n}).call(this);\n\n//# sourceMappingURL=hot_renderers.js.map\n"]} \ No newline at end of file diff --git a/dist/pivot.js b/dist/pivot.js index 489e412a..326877ad 100644 --- a/dist/pivot.js +++ b/dist/pivot.js @@ -636,6 +636,8 @@ this.getAggregator = bind(this.getAggregator, this); this.getRowKeys = bind(this.getRowKeys, this); this.getColKeys = bind(this.getColKeys, this); + this.getRowLimit = bind(this.getRowLimit, this); + this.getColLimit = bind(this.getColLimit, this); this.sortKeys = bind(this.sortKeys, this); this.arrSort = bind(this.arrSort, this); this.input = input; @@ -658,6 +660,8 @@ this.colTotals = {}; this.allTotal = this.aggregator(this, [], []); this.sorted = false; + this.rowLimit = opts.hot === true && opts.rowLimit > 0 ? opts.rowLimit : 0; + this.colLimit = opts.hot === true && opts.colLimit > 0 ? opts.colLimit : 0; PivotData.forEachRecord(this.input, this.derivedAttributes, (function(_this) { return function(record) { if (_this.filter(record)) { @@ -816,6 +820,14 @@ } }; + PivotData.prototype.getColLimit = function() { + return this.colLimit; + }; + + PivotData.prototype.getRowLimit = function() { + return this.rowLimit; + }; + PivotData.prototype.getColKeys = function() { this.sortKeys(); return this.colKeys; diff --git a/dist/pivot.js.map b/dist/pivot.js.map index a45720b3..b8d796c1 100644 --- a/dist/pivot.js.map +++ b/dist/pivot.js.map @@ -1 +1 @@ -{"version":3,"file":"pivot.js","sources":["pivot.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;;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IAAI,CAAC,GAAL,CAAS;cAAA,SAAA,EAAW,CAAX;cAAa,aAAA,EAAe,KAA5B;cAAmC,YAAA,EAAc,QAAjD;aAAT,CAAmE,CAAC,IAApE,CAAyE,OAAzE;UAzBQ,CAAZ;QAhBS;MAAA,CAAA,CAAA,CAAA,IAAA;AA2Cb,WAAsC,gFAAtC;QAAA,UAAA,CAAW,aAAA,GAAc,CAAzB;AAAA;MACA,UAAA,CAAW,oBAAX;AAEA,aAAO;IAlDK;EAxjCL,CAAf;AATA","sourcesContent":["callWithJQuery = (pivotModule) ->\n if typeof exports is \"object\" and typeof module is \"object\" # CommonJS\n pivotModule require(\"jquery\")\n else if typeof define is \"function\" and define.amd # AMD\n define [\"jquery\"], pivotModule\n # Plain browser env\n else\n pivotModule jQuery\n\ncallWithJQuery ($) ->\n\n ###\n Utilities\n ###\n\n addSeparators = (nStr, thousandsSep, decimalSep) ->\n nStr += ''\n x = nStr.split('.')\n x1 = x[0]\n x2 = if x.length > 1 then decimalSep + x[1] else ''\n rgx = /(\\d+)(\\d{3})/\n x1 = x1.replace(rgx, '$1' + thousandsSep + '$2') while rgx.test(x1)\n return x1 + x2\n\n numberFormat = (opts) ->\n defaults =\n digitsAfterDecimal: 2, scaler: 1,\n thousandsSep: \",\", decimalSep: \".\"\n prefix: \"\", suffix: \"\"\n opts = $.extend({}, defaults, opts)\n (x) ->\n return \"\" if isNaN(x) or not isFinite(x)\n result = addSeparators (opts.scaler*x).toFixed(opts.digitsAfterDecimal), opts.thousandsSep, opts.decimalSep\n return \"\"+opts.prefix+result+opts.suffix\n\n #aggregator templates default to US number formatting but this is overrideable\n usFmt = numberFormat()\n usFmtInt = numberFormat(digitsAfterDecimal: 0)\n usFmtPct = numberFormat(digitsAfterDecimal:1, scaler: 100, suffix: \"%\")\n\n aggregatorTemplates =\n count: (formatter=usFmtInt) -> () -> (data, rowKey, colKey) ->\n count: 0\n push: -> @count++\n value: -> @count\n format: formatter\n\n uniques: (fn, formatter=usFmtInt) -> ([attr]) -> (data, rowKey, colKey) ->\n uniq: []\n push: (record) -> @uniq.push(record[attr]) if record[attr] not in @uniq\n value: -> fn(@uniq)\n format: formatter\n numInputs: if attr? then 0 else 1\n\n sum: (formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n sum: 0\n push: (record) -> @sum += parseFloat(record[attr]) if not isNaN parseFloat(record[attr])\n value: -> @sum\n format: formatter\n numInputs: if attr? then 0 else 1\n\n extremes: (mode, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n val: null\n sorter: getSort(data?.sorters, attr)\n push: (record) ->\n x = record[attr]\n if mode in [\"min\", \"max\"]\n x = parseFloat(x)\n if not isNaN x then @val = Math[mode](x, @val ? x)\n if mode == \"first\" then @val = x if @sorter(x, @val ? x) <= 0\n if mode == \"last\" then @val = x if @sorter(x, @val ? x) >= 0\n value: -> @val\n format: (x) -> if isNaN(x) then x else formatter(x)\n numInputs: if attr? then 0 else 1\n\n quantile: (q, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n vals: []\n push: (record) ->\n x = parseFloat(record[attr])\n @vals.push(x) if not isNaN(x)\n value: ->\n return null if @vals.length == 0\n @vals.sort((a,b) -> a-b)\n i = (@vals.length-1)*q\n return (@vals[Math.floor(i)] + @vals[Math.ceil(i)])/2.0\n format: formatter\n numInputs: if attr? then 0 else 1\n\n runningStat: (mode=\"mean\", ddof=1, formatter=usFmt) -> ([attr]) -> (data, rowKey, colKey) ->\n n: 0.0, m: 0.0, s: 0.0\n push: (record) ->\n x = parseFloat(record[attr])\n return if isNaN(x)\n @n += 1.0\n if @n == 1.0\n @m = x\n else\n m_new = @m + (x - @m)/@n\n @s = @s + (x - @m)*(x - m_new)\n @m = m_new\n value: ->\n if mode == \"mean\"\n return if @n == 0 then 0/0 else @m\n return 0 if @n <= ddof\n switch mode\n when \"var\" then @s/(@n-ddof)\n when \"stdev\" then Math.sqrt(@s/(@n-ddof))\n format: formatter\n numInputs: if attr? then 0 else 1\n\n sumOverSum: (formatter=usFmt) -> ([num, denom]) -> (data, rowKey, colKey) ->\n sumNum: 0\n sumDenom: 0\n push: (record) ->\n @sumNum += parseFloat(record[num]) if not isNaN parseFloat(record[num])\n @sumDenom += parseFloat(record[denom]) if not isNaN parseFloat(record[denom])\n value: -> @sumNum/@sumDenom\n format: formatter\n numInputs: if num? and denom? then 0 else 2\n\n sumOverSumBound80: (upper=true, formatter=usFmt) -> ([num, denom]) -> (data, rowKey, colKey) ->\n sumNum: 0\n sumDenom: 0\n push: (record) ->\n @sumNum += parseFloat(record[num]) if not isNaN parseFloat(record[num])\n @sumDenom += parseFloat(record[denom]) if not isNaN parseFloat(record[denom])\n value: ->\n sign = if upper then 1 else -1\n (0.821187207574908/@sumDenom + @sumNum/@sumDenom + 1.2815515655446004*sign*\n Math.sqrt(0.410593603787454/ (@sumDenom*@sumDenom) + (@sumNum*(1 - @sumNum/ @sumDenom))/ (@sumDenom*@sumDenom)))/\n (1 + 1.642374415149816/@sumDenom)\n format: formatter\n numInputs: if num? and denom? then 0 else 2\n\n fractionOf: (wrapped, type=\"total\", formatter=usFmtPct) -> (x...) -> (data, rowKey, colKey) ->\n selector: {total:[[],[]],row:[rowKey,[]],col:[[],colKey]}[type]\n inner: wrapped(x...)(data, rowKey, colKey)\n push: (record) -> @inner.push record\n format: formatter\n value: -> @inner.value() / data.getAggregator(@selector...).inner.value()\n numInputs: wrapped(x...)().numInputs\n\n aggregatorTemplates.countUnique = (f) -> aggregatorTemplates.uniques(((x) -> x.length), f)\n aggregatorTemplates.listUnique = (s) -> aggregatorTemplates.uniques(((x) -> x.sort(naturalSort).join(s)), ((x)->x))\n aggregatorTemplates.max = (f) -> aggregatorTemplates.extremes('max', f)\n aggregatorTemplates.min = (f) -> aggregatorTemplates.extremes('min', f)\n aggregatorTemplates.first = (f) -> aggregatorTemplates.extremes('first', f)\n aggregatorTemplates.last = (f) -> aggregatorTemplates.extremes('last', f)\n aggregatorTemplates.median = (f) -> aggregatorTemplates.quantile(0.5, f)\n aggregatorTemplates.average = (f) -> aggregatorTemplates.runningStat(\"mean\", 1, f)\n aggregatorTemplates.var = (ddof, f) -> aggregatorTemplates.runningStat(\"var\", ddof, f)\n aggregatorTemplates.stdev = (ddof, f) -> aggregatorTemplates.runningStat(\"stdev\", ddof, f)\n\n #default aggregators & renderers use US naming and number formatting\n aggregators = do (tpl = aggregatorTemplates) ->\n \"Count\": tpl.count(usFmtInt)\n \"Count Unique Values\": tpl.countUnique(usFmtInt)\n \"List Unique Values\": tpl.listUnique(\", \")\n \"Sum\": tpl.sum(usFmt)\n \"Integer Sum\": tpl.sum(usFmtInt)\n \"Average\": tpl.average(usFmt)\n \"Median\": tpl.median(usFmt)\n \"Sample Variance\": tpl.var(1, usFmt)\n \"Sample Standard Deviation\": tpl.stdev(1, usFmt)\n \"Minimum\": tpl.min(usFmt)\n \"Maximum\": tpl.max(usFmt)\n \"First\": tpl.first(usFmt)\n \"Last\": tpl.last(usFmt)\n \"Sum over Sum\": tpl.sumOverSum(usFmt)\n \"80% Upper Bound\": tpl.sumOverSumBound80(true, usFmt)\n \"80% Lower Bound\": tpl.sumOverSumBound80(false, usFmt)\n \"Sum as Fraction of Total\": tpl.fractionOf(tpl.sum(), \"total\", usFmtPct)\n \"Sum as Fraction of Rows\": tpl.fractionOf(tpl.sum(), \"row\", usFmtPct)\n \"Sum as Fraction of Columns\": tpl.fractionOf(tpl.sum(), \"col\", usFmtPct)\n \"Count as Fraction of Total\": tpl.fractionOf(tpl.count(), \"total\", usFmtPct)\n \"Count as Fraction of Rows\": tpl.fractionOf(tpl.count(), \"row\", usFmtPct)\n \"Count as Fraction of Columns\": tpl.fractionOf(tpl.count(), \"col\", usFmtPct)\n\n renderers =\n \"Table\": (data, opts) -> pivotTableRenderer(data, opts)\n \"Table Barchart\": (data, opts) -> $(pivotTableRenderer(data, opts)).barchart()\n \"Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"heatmap\", opts)\n \"Row Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"rowheatmap\", opts)\n \"Col Heatmap\": (data, opts) -> $(pivotTableRenderer(data, opts)).heatmap(\"colheatmap\", opts)\n\n locales =\n en:\n aggregators: aggregators\n renderers: renderers\n localeStrings:\n renderError: \"An error occurred rendering the PivotTable results.\"\n computeError: \"An error occurred computing the PivotTable results.\"\n uiRenderError: \"An error occurred rendering the PivotTable UI.\"\n selectAll: \"Select All\"\n selectNone: \"Select None\"\n tooMany: \"(too many to list)\"\n filterResults: \"Filter values\"\n apply: \"Apply\"\n cancel: \"Cancel\"\n totals: \"Totals\" #for table renderer\n vs: \"vs\" #for gchart renderer\n by: \"by\" #for gchart renderer\n\n #dateFormat deriver l10n requires month and day names to be passed in directly\n mthNamesEn = [\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"]\n dayNamesEn = [\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"]\n zeroPad = (number) -> (\"0\"+number).substr(-2,2)\n\n derivers =\n bin: (col, binWidth) -> (record) -> record[col] - record[col] % binWidth\n dateFormat: (col, formatString, utcOutput=false, mthNames=mthNamesEn, dayNames=dayNamesEn) ->\n utc = if utcOutput then \"UTC\" else \"\"\n (record) -> #thanks http://stackoverflow.com/a/12213072/112871\n date = new Date(Date.parse(record[col]))\n if isNaN(date) then return \"\"\n formatString.replace /%(.)/g, (m, p) ->\n switch p\n when \"y\" then date[\"get#{utc}FullYear\"]()\n when \"m\" then zeroPad(date[\"get#{utc}Month\"]()+1)\n when \"n\" then mthNames[date[\"get#{utc}Month\"]()]\n when \"d\" then zeroPad(date[\"get#{utc}Date\"]())\n when \"w\" then dayNames[date[\"get#{utc}Day\"]()]\n when \"x\" then date[\"get#{utc}Day\"]()\n when \"H\" then zeroPad(date[\"get#{utc}Hours\"]())\n when \"M\" then zeroPad(date[\"get#{utc}Minutes\"]())\n when \"S\" then zeroPad(date[\"get#{utc}Seconds\"]())\n else \"%\" + p\n\n rx = /(\\d+)|(\\D+)/g\n rd = /\\d/\n rz = /^0/\n naturalSort = (as, bs) =>\n #nulls first\n return -1 if bs? and not as?\n return 1 if as? and not bs?\n\n #then raw NaNs\n return -1 if typeof as == \"number\" and isNaN(as)\n return 1 if typeof bs == \"number\" and isNaN(bs)\n\n #numbers and numbery strings group together\n nas = +as\n nbs = +bs\n return -1 if nas < nbs\n return 1 if nas > nbs\n\n #within that, true numbers before numbery strings\n return -1 if typeof as == \"number\" and typeof bs != \"number\"\n return 1 if typeof bs == \"number\" and typeof as != \"number\"\n return 0 if typeof as == \"number\" and typeof bs == \"number\"\n\n # 'Infinity' is a textual number, so less than 'A'\n return -1 if isNaN(nbs) and not isNaN(nas)\n return 1 if isNaN(nas) and not isNaN(nbs)\n\n #finally, \"smart\" string sorting per http://stackoverflow.com/a/4373421/112871\n a = String(as)\n b = String(bs)\n return 0 if a == b\n return (if a > b then 1 else -1) unless rd.test(a) and rd.test(b)\n\n #special treatment for strings containing digits\n a = a.match(rx) #create digits vs non-digit chunks and iterate through\n b = b.match(rx)\n while a.length and b.length\n a1 = a.shift()\n b1 = b.shift()\n if a1 != b1\n if rd.test(a1) and rd.test(b1) #both are digit chunks\n return a1.replace(rz, \".0\") - b1.replace(rz, \".0\")\n else\n return (if a1 > b1 then 1 else -1)\n return a.length - b.length\n\n sortAs = (order) ->\n mapping = {}\n l_mapping = {} # sort lowercased keys similarly\n for i, x of order\n mapping[x] = i\n l_mapping[x.toLowerCase()] = i if typeof x == \"string\"\n (a, b) ->\n if mapping[a]? and mapping[b]? then mapping[a] - mapping[b]\n else if mapping[a]? then -1\n else if mapping[b]? then 1\n else if l_mapping[a]? and l_mapping[b]? then l_mapping[a] - l_mapping[b]\n else if l_mapping[a]? then -1\n else if l_mapping[b]? then 1\n else naturalSort(a,b)\n\n getSort = (sorters, attr) ->\n if sorters?\n if $.isFunction(sorters)\n sort = sorters(attr)\n return sort if $.isFunction(sort)\n else if sorters[attr]?\n return sorters[attr]\n return naturalSort\n\n ###\n Data Model class\n ###\n\n class PivotData\n constructor: (input, opts = {}) ->\n @input = input\n @aggregator = opts.aggregator ? aggregatorTemplates.count()()\n @aggregatorName = opts.aggregatorName ? \"Count\"\n @colAttrs = opts.cols ? []\n @rowAttrs = opts.rows ? []\n @valAttrs = opts.vals ? []\n @sorters = opts.sorters ? {}\n @rowOrder = opts.rowOrder ? \"key_a_to_z\"\n @colOrder = opts.colOrder ? \"key_a_to_z\"\n @derivedAttributes = opts.derivedAttributes ? {}\n @filter = opts.filter ? (-> true)\n @tree = {}\n @rowKeys = []\n @colKeys = []\n @rowTotals = {}\n @colTotals = {}\n @allTotal = @aggregator(this, [], [])\n @sorted = false\n\n # iterate through input, accumulating data for cells\n PivotData.forEachRecord @input, @derivedAttributes, (record) =>\n @processRecord(record) if @filter(record)\n\n #can handle arrays or jQuery selections of tables\n @forEachRecord = (input, derivedAttributes, f) ->\n if $.isEmptyObject derivedAttributes\n addRecord = f\n else\n addRecord = (record) ->\n record[k] = v(record) ? record[k] for k, v of derivedAttributes\n f(record)\n\n #if it's a function, have it call us back\n if $.isFunction(input)\n input(addRecord)\n else if $.isArray(input)\n if $.isArray(input[0]) #array of arrays\n for own i, compactRecord of input when i > 0\n record = {}\n record[k] = compactRecord[j] for own j, k of input[0]\n addRecord(record)\n else #array of objects\n addRecord(record) for record in input\n else if input instanceof $\n tblCols = []\n $(\"thead > tr > th\", input).each (i) -> tblCols.push $(this).text()\n $(\"tbody > tr\", input).each (i) ->\n record = {}\n $(\"td\", this).each (j) -> record[tblCols[j]] = $(this).text()\n addRecord(record)\n else\n throw new Error(\"unknown input format\")\n\n forEachMatchingRecord: (criteria, callback) ->\n PivotData.forEachRecord @input, @derivedAttributes, (record) =>\n return if not @filter(record)\n for k, v of criteria\n return if v != (record[k] ? \"null\")\n callback(record)\n\n arrSort: (attrs) =>\n sortersArr = (getSort(@sorters, a) for a in attrs)\n (a,b) ->\n for own i, sorter of sortersArr\n comparison = sorter(a[i], b[i])\n return comparison if comparison != 0\n return 0\n\n sortKeys: () =>\n if not @sorted\n @sorted = true\n v = (r,c) => @getAggregator(r,c).value()\n switch @rowOrder\n when \"value_a_to_z\" then @rowKeys.sort (a,b) => naturalSort v(a,[]), v(b,[])\n when \"value_z_to_a\" then @rowKeys.sort (a,b) => -naturalSort v(a,[]), v(b,[])\n else @rowKeys.sort @arrSort(@rowAttrs)\n switch @colOrder\n when \"value_a_to_z\" then @colKeys.sort (a,b) => naturalSort v([],a), v([],b)\n when \"value_z_to_a\" then @colKeys.sort (a,b) => -naturalSort v([],a), v([],b)\n else @colKeys.sort @arrSort(@colAttrs)\n\n getColKeys: () =>\n @sortKeys()\n return @colKeys\n\n getRowKeys: () =>\n @sortKeys()\n return @rowKeys\n\n processRecord: (record) -> #this code is called in a tight loop\n colKey = []\n rowKey = []\n colKey.push record[x] ? \"null\" for x in @colAttrs\n rowKey.push record[x] ? \"null\" for x in @rowAttrs\n flatRowKey = rowKey.join(String.fromCharCode(0))\n flatColKey = colKey.join(String.fromCharCode(0))\n\n @allTotal.push record\n\n if rowKey.length != 0\n if not @rowTotals[flatRowKey]\n @rowKeys.push rowKey\n @rowTotals[flatRowKey] = @aggregator(this, rowKey, [])\n @rowTotals[flatRowKey].push record\n\n if colKey.length != 0\n if not @colTotals[flatColKey]\n @colKeys.push colKey\n @colTotals[flatColKey] = @aggregator(this, [], colKey)\n @colTotals[flatColKey].push record\n\n if colKey.length != 0 and rowKey.length != 0\n if not @tree[flatRowKey]\n @tree[flatRowKey] = {}\n if not @tree[flatRowKey][flatColKey]\n @tree[flatRowKey][flatColKey] = @aggregator(this, rowKey, colKey)\n @tree[flatRowKey][flatColKey].push record\n\n getAggregator: (rowKey, colKey) =>\n flatRowKey = rowKey.join(String.fromCharCode(0))\n flatColKey = colKey.join(String.fromCharCode(0))\n if rowKey.length == 0 and colKey.length == 0\n agg = @allTotal\n else if rowKey.length == 0\n agg = @colTotals[flatColKey]\n else if colKey.length == 0\n agg = @rowTotals[flatRowKey]\n else\n agg = @tree[flatRowKey][flatColKey]\n return agg ? {value: (-> null), format: -> \"\"}\n\n #expose these to the outside world\n $.pivotUtilities = {aggregatorTemplates, aggregators, renderers, derivers, locales,\n naturalSort, numberFormat, sortAs, PivotData}\n\n ###\n Default Renderer for hierarchical table layout\n ###\n\n pivotTableRenderer = (pivotData, opts) ->\n\n defaults =\n table:\n clickCallback: null\n rowTotals: true\n colTotals: true\n localeStrings: totals: \"Totals\"\n\n opts = $.extend(true, {}, defaults, opts)\n\n colAttrs = pivotData.colAttrs\n rowAttrs = pivotData.rowAttrs\n rowKeys = pivotData.getRowKeys()\n colKeys = pivotData.getColKeys()\n\n if opts.table.clickCallback\n getClickHandler = (value, rowValues, colValues) ->\n filters = {}\n filters[attr] = colValues[i] for own i, attr of colAttrs when colValues[i]?\n filters[attr] = rowValues[i] for own i, attr of rowAttrs when rowValues[i]?\n return (e) -> opts.table.clickCallback(e, value, filters, pivotData)\n\n #now actually build the output\n result = document.createElement(\"table\")\n result.className = \"pvtTable\"\n\n #helper function for setting row/col-span in pivotTableRenderer\n spanSize = (arr, i, j) ->\n if i != 0\n noDraw = true\n for x in [0..j]\n if arr[i-1][x] != arr[i][x]\n noDraw = false\n if noDraw\n return -1 #do not draw cell\n len = 0\n while i+len < arr.length\n stop = false\n for x in [0..j]\n stop = true if arr[i][x] != arr[i+len][x]\n break if stop\n len++\n return len\n\n #the first few rows are for col headers\n thead = document.createElement(\"thead\")\n for own j, c of colAttrs\n tr = document.createElement(\"tr\")\n if parseInt(j) == 0 and rowAttrs.length != 0\n th = document.createElement(\"th\")\n th.setAttribute(\"colspan\", rowAttrs.length)\n th.setAttribute(\"rowspan\", colAttrs.length)\n tr.appendChild th\n th = document.createElement(\"th\")\n th.className = \"pvtAxisLabel\"\n th.textContent = c\n tr.appendChild th\n for own i, colKey of colKeys\n x = spanSize(colKeys, parseInt(i), parseInt(j))\n if x != -1\n th = document.createElement(\"th\")\n th.className = \"pvtColLabel\"\n th.textContent = colKey[j]\n th.setAttribute(\"colspan\", x)\n if parseInt(j) == colAttrs.length-1 and rowAttrs.length != 0\n th.setAttribute(\"rowspan\", 2)\n tr.appendChild th\n if parseInt(j) == 0 && opts.table.rowTotals\n th = document.createElement(\"th\")\n th.className = \"pvtTotalLabel pvtRowTotalLabel\"\n th.innerHTML = opts.localeStrings.totals\n th.setAttribute(\"rowspan\", colAttrs.length + (if rowAttrs.length ==0 then 0 else 1))\n tr.appendChild th\n thead.appendChild tr\n\n #then a row for row header headers\n if rowAttrs.length !=0\n tr = document.createElement(\"tr\")\n for own i, r of rowAttrs\n th = document.createElement(\"th\")\n th.className = \"pvtAxisLabel\"\n th.textContent = r\n tr.appendChild th\n th = document.createElement(\"th\")\n if colAttrs.length ==0\n th.className = \"pvtTotalLabel pvtRowTotalLabel\"\n th.innerHTML = opts.localeStrings.totals\n tr.appendChild th\n thead.appendChild tr\n result.appendChild thead\n\n #now the actual data rows, with their row headers and totals\n tbody = document.createElement(\"tbody\")\n for own i, rowKey of rowKeys\n tr = document.createElement(\"tr\")\n for own j, txt of rowKey\n x = spanSize(rowKeys, parseInt(i), parseInt(j))\n if x != -1\n th = document.createElement(\"th\")\n th.className = \"pvtRowLabel\"\n th.textContent = txt\n th.setAttribute(\"rowspan\", x)\n if parseInt(j) == rowAttrs.length-1 and colAttrs.length !=0\n th.setAttribute(\"colspan\",2)\n tr.appendChild th\n for own j, colKey of colKeys #this is the tight loop\n aggregator = pivotData.getAggregator(rowKey, colKey)\n val = aggregator.value()\n td = document.createElement(\"td\")\n td.className = \"pvtVal row#{i} col#{j}\"\n td.textContent = aggregator.format(val)\n td.setAttribute(\"data-value\", val)\n if getClickHandler?\n td.onclick = getClickHandler(val, rowKey, colKey)\n tr.appendChild td\n\n if opts.table.rowTotals || colAttrs.length == 0\n totalAggregator = pivotData.getAggregator(rowKey, [])\n val = totalAggregator.value()\n td = document.createElement(\"td\")\n td.className = \"pvtTotal rowTotal\"\n td.textContent = totalAggregator.format(val)\n td.setAttribute(\"data-value\", val)\n if getClickHandler?\n td.onclick = getClickHandler(val, rowKey, [])\n td.setAttribute(\"data-for\", \"row\"+i)\n tr.appendChild td\n tbody.appendChild tr\n\n #finally, the row for col totals, and a grand total\n if opts.table.colTotals || rowAttrs.length == 0\n tr = document.createElement(\"tr\")\n if opts.table.colTotals || rowAttrs.length == 0\n th = document.createElement(\"th\")\n th.className = \"pvtTotalLabel pvtColTotalLabel\"\n th.innerHTML = opts.localeStrings.totals\n th.setAttribute(\"colspan\", rowAttrs.length + (if colAttrs.length == 0 then 0 else 1))\n tr.appendChild th\n for own j, colKey of colKeys\n totalAggregator = pivotData.getAggregator([], colKey)\n val = totalAggregator.value()\n td = document.createElement(\"td\")\n td.className = \"pvtTotal colTotal\"\n td.textContent = totalAggregator.format(val)\n td.setAttribute(\"data-value\", val)\n if getClickHandler?\n td.onclick = getClickHandler(val, [], colKey)\n td.setAttribute(\"data-for\", \"col\"+j)\n tr.appendChild td\n if opts.table.rowTotals || colAttrs.length == 0\n totalAggregator = pivotData.getAggregator([], [])\n val = totalAggregator.value()\n td = document.createElement(\"td\")\n td.className = \"pvtGrandTotal\"\n td.textContent = totalAggregator.format(val)\n td.setAttribute(\"data-value\", val)\n if getClickHandler?\n td.onclick = getClickHandler(val, [], [])\n tr.appendChild td\n tbody.appendChild tr\n result.appendChild tbody\n\n #squirrel this away for later\n result.setAttribute(\"data-numrows\", rowKeys.length)\n result.setAttribute(\"data-numcols\", colKeys.length)\n\n return result\n\n ###\n Pivot Table core: create PivotData object and call Renderer on it\n ###\n\n $.fn.pivot = (input, inputOpts, locale=\"en\") ->\n locale = \"en\" if not locales[locale]?\n defaults =\n cols : [], rows: [], vals: []\n rowOrder: \"key_a_to_z\", colOrder: \"key_a_to_z\"\n dataClass: PivotData\n filter: -> true\n aggregator: aggregatorTemplates.count()()\n aggregatorName: \"Count\"\n sorters: {}\n derivedAttributes: {}\n renderer: pivotTableRenderer\n\n localeStrings = $.extend(true, {}, locales.en.localeStrings, locales[locale].localeStrings)\n localeDefaults =\n rendererOptions: {localeStrings}\n localeStrings: localeStrings\n\n opts = $.extend(true, {}, localeDefaults, $.extend({}, defaults, inputOpts))\n\n result = null\n try\n pivotData = new opts.dataClass(input, opts)\n try\n result = opts.renderer(pivotData, opts.rendererOptions)\n catch e\n console.error(e.stack) if console?\n result = $(\"\").html opts.localeStrings.renderError\n catch e\n console.error(e.stack) if console?\n result = $(\"\").html opts.localeStrings.computeError\n\n x = this[0]\n x.removeChild(x.lastChild) while x.hasChildNodes()\n return @append result\n\n\n ###\n Pivot Table UI: calls Pivot Table core above with options set by user\n ###\n\n $.fn.pivotUI = (input, inputOpts, overwrite = false, locale=\"en\") ->\n locale = \"en\" if not locales[locale]?\n defaults =\n derivedAttributes: {}\n aggregators: locales[locale].aggregators\n renderers: locales[locale].renderers\n hiddenAttributes: []\n hiddenFromAggregators: []\n hiddenFromDragDrop: []\n menuLimit: 500\n cols: [], rows: [], vals: []\n rowOrder: \"key_a_to_z\", colOrder: \"key_a_to_z\"\n dataClass: PivotData\n exclusions: {}\n inclusions: {}\n unusedAttrsVertical: 85\n autoSortUnusedAttrs: false\n onRefresh: null\n showUI: true\n filter: -> true\n sorters: {}\n\n localeStrings = $.extend(true, {}, locales.en.localeStrings, locales[locale].localeStrings)\n localeDefaults =\n rendererOptions: {localeStrings}\n localeStrings: localeStrings\n\n existingOpts = @data \"pivotUIOptions\"\n if not existingOpts? or overwrite\n opts = $.extend(true, {}, localeDefaults, $.extend({}, defaults, inputOpts))\n else\n opts = existingOpts\n\n try\n # do a first pass on the data to cache a materialized copy of any\n # function-valued inputs and to compute dimension cardinalities\n attrValues = {}\n materializedInput = []\n recordsProcessed = 0\n PivotData.forEachRecord input, opts.derivedAttributes, (record) ->\n return unless opts.filter(record)\n materializedInput.push(record)\n for own attr of record\n if not attrValues[attr]?\n attrValues[attr] = {}\n if recordsProcessed > 0\n attrValues[attr][\"null\"] = recordsProcessed\n for attr of attrValues\n value = record[attr] ? \"null\"\n attrValues[attr][value] ?= 0\n attrValues[attr][value]++\n recordsProcessed++\n\n #start building the output\n uiTable = $(\"\", \"class\": \"pvtUi\").attr(\"cellpadding\", 5)\n\n #renderer control\n rendererControl = $(\"\").appendTo(uiTable)\n\n #aggregator menu and value area\n\n aggregator = $(\"\").appendTo(uiTable)\n\n #row axes\n tr2.append $(\"\").append(rendererControl).append(unused)\n\n #render the UI in its default state\n @html uiTable\n\n #set up the UI initial state as requested by moving elements around\n\n for x in opts.cols\n @find(\".pvtCols\").append @find(\".axis_#{$.inArray(x, shownInDragDrop)}\")\n for x in opts.rows\n @find(\".pvtRows\").append @find(\".axis_#{$.inArray(x, shownInDragDrop)}\")\n if opts.aggregatorName?\n @find(\".pvtAggregator\").val opts.aggregatorName\n if opts.rendererName?\n @find(\".pvtRenderer\").val opts.rendererName\n\n @find(\".pvtUiCell\").hide() unless opts.showUI\n\n initialRender = true\n\n #set up for refreshing\n refreshDelayed = =>\n subopts =\n derivedAttributes: opts.derivedAttributes\n localeStrings: opts.localeStrings\n rendererOptions: opts.rendererOptions\n sorters: opts.sorters\n cols: [], rows: []\n dataClass: opts.dataClass\n\n numInputsToProcess = opts.aggregators[aggregator.val()]([])().numInputs ? 0\n vals = []\n @find(\".pvtRows li span.pvtAttr\").each -> subopts.rows.push $(this).data(\"attrName\")\n @find(\".pvtCols li span.pvtAttr\").each -> subopts.cols.push $(this).data(\"attrName\")\n @find(\".pvtVals select.pvtAttrDropdown\").each ->\n if numInputsToProcess == 0\n $(this).remove()\n else\n numInputsToProcess--\n vals.push $(this).val() if $(this).val() != \"\"\n\n if numInputsToProcess != 0\n pvtVals = @find(\".pvtVals\")\n for x in [0...numInputsToProcess]\n newDropdown = $(\"
\").addClass(\"pvtUiCell\")\n\n renderer = $(\"\").addClass('pvtAxisContainer pvtUnused pvtUiCell')\n shownAttributes = (a for a of attrValues when a not in opts.hiddenAttributes)\n shownInAggregators = (c for c in shownAttributes when c not in opts.hiddenFromAggregators)\n shownInDragDrop = (c for c in shownAttributes when c not in opts.hiddenFromDragDrop)\n\n\n unusedAttrsVerticalAutoOverride = false\n if opts.unusedAttrsVertical == \"auto\"\n unusedAttrsVerticalAutoCutoff = 120 # legacy support\n else\n unusedAttrsVerticalAutoCutoff = parseInt opts.unusedAttrsVertical\n\n if not isNaN(unusedAttrsVerticalAutoCutoff)\n attrLength = 0\n attrLength += a.length for a in shownInDragDrop\n unusedAttrsVerticalAutoOverride = attrLength > unusedAttrsVerticalAutoCutoff\n\n if opts.unusedAttrsVertical == true or unusedAttrsVerticalAutoOverride\n unused.addClass('pvtVertList')\n else\n unused.addClass('pvtHorizList')\n\n for own i, attr of shownInDragDrop\n do (attr) ->\n values = (v for v of attrValues[attr])\n hasExcludedItem = false\n valueList = $(\"
\").addClass('pvtFilterBox').hide()\n\n valueList.append $(\"

\").append(\n $(\"\").text(attr),\n $(\"\").addClass(\"count\").text(\"(#{values.length})\"),\n )\n if values.length > opts.menuLimit\n valueList.append $(\"

\").html(opts.localeStrings.tooMany)\n else\n if values.length > 5\n controls = $(\"

\").appendTo(valueList)\n sorter = getSort(opts.sorters, attr)\n placeholder = opts.localeStrings.filterResults\n $(\"\", {type: \"text\"}).appendTo(controls)\n .attr({placeholder: placeholder, class: \"pvtSearch\"})\n .bind \"keyup\", ->\n filter = $(this).val().toLowerCase().trim()\n accept_gen = (prefix, accepted) -> (v) ->\n real_filter = filter.substring(prefix.length).trim()\n return true if real_filter.length == 0\n return Math.sign(sorter(v.toLowerCase(), real_filter)) in accepted\n accept =\n if filter.indexOf(\">=\") == 0 then accept_gen(\">=\", [1,0])\n else if filter.indexOf(\"<=\") == 0 then accept_gen(\"<=\", [-1,0])\n else if filter.indexOf(\">\") == 0 then accept_gen(\">\", [1])\n else if filter.indexOf(\"<\") == 0 then accept_gen(\"<\", [-1])\n else if filter.indexOf(\"~\") == 0 then (v) ->\n return true if filter.substring(1).trim().length == 0\n v.toLowerCase().match(filter.substring(1))\n else (v) -> v.toLowerCase().indexOf(filter) != -1\n\n valueList.find('.pvtCheckContainer p label span.value').each ->\n if accept($(this).text())\n $(this).parent().parent().show()\n else\n $(this).parent().parent().hide()\n controls.append $(\"
\")\n $(\"

\").addClass('pvtVals pvtUiCell')\n .appendTo(tr1)\n .append(aggregator)\n .append(rowOrderArrow)\n .append(colOrderArrow)\n .append($(\"
\"))\n\n #column axes\n $(\"
\").addClass('pvtAxisContainer pvtHorizList pvtCols pvtUiCell').appendTo(tr1)\n\n tr2 = $(\"
\").addClass('pvtAxisContainer pvtRows pvtUiCell').attr(\"valign\", \"top\")\n\n #the actual pivot table container\n pivotTable = $(\"\")\n .attr(\"valign\", \"top\")\n .addClass('pvtRendererArea')\n .appendTo(tr2)\n\n #finally the renderer dropdown and unused attribs are inserted at the requested location\n if opts.unusedAttrsVertical == true or unusedAttrsVerticalAutoOverride\n uiTable.find('tr:nth-child(1)').prepend rendererControl\n uiTable.find('tr:nth-child(2)').prepend unused\n else\n uiTable.prepend $(\"
\", \"class\": \"pvtUi\").attr(\"cellpadding\", 5)\n\n #renderer control\n rendererControl = $(\"\").appendTo(uiTable)\n\n #aggregator menu and value area\n\n aggregator = $(\"\").appendTo(uiTable)\n\n #row axes\n tr2.append $(\"\").append(rendererControl).append(unused)\n\n #render the UI in its default state\n @html uiTable\n\n #set up the UI initial state as requested by moving elements around\n\n for x in opts.cols\n @find(\".pvtCols\").append @find(\".axis_#{$.inArray(x, shownInDragDrop)}\")\n for x in opts.rows\n @find(\".pvtRows\").append @find(\".axis_#{$.inArray(x, shownInDragDrop)}\")\n if opts.aggregatorName?\n @find(\".pvtAggregator\").val opts.aggregatorName\n if opts.rendererName?\n @find(\".pvtRenderer\").val opts.rendererName\n\n @find(\".pvtUiCell\").hide() unless opts.showUI\n\n initialRender = true\n\n #set up for refreshing\n refreshDelayed = =>\n subopts =\n derivedAttributes: opts.derivedAttributes\n localeStrings: opts.localeStrings\n rendererOptions: opts.rendererOptions\n sorters: opts.sorters\n cols: [], rows: []\n dataClass: opts.dataClass\n\n numInputsToProcess = opts.aggregators[aggregator.val()]([])().numInputs ? 0\n vals = []\n @find(\".pvtRows li span.pvtAttr\").each -> subopts.rows.push $(this).data(\"attrName\")\n @find(\".pvtCols li span.pvtAttr\").each -> subopts.cols.push $(this).data(\"attrName\")\n @find(\".pvtVals select.pvtAttrDropdown\").each ->\n if numInputsToProcess == 0\n $(this).remove()\n else\n numInputsToProcess--\n vals.push $(this).val() if $(this).val() != \"\"\n\n if numInputsToProcess != 0\n pvtVals = @find(\".pvtVals\")\n for x in [0...numInputsToProcess]\n newDropdown = $(\"
\").addClass(\"pvtUiCell\")\n\n renderer = $(\"\").addClass('pvtAxisContainer pvtUnused pvtUiCell')\n shownAttributes = (a for a of attrValues when a not in opts.hiddenAttributes)\n shownInAggregators = (c for c in shownAttributes when c not in opts.hiddenFromAggregators)\n shownInDragDrop = (c for c in shownAttributes when c not in opts.hiddenFromDragDrop)\n\n\n unusedAttrsVerticalAutoOverride = false\n if opts.unusedAttrsVertical == \"auto\"\n unusedAttrsVerticalAutoCutoff = 120 # legacy support\n else\n unusedAttrsVerticalAutoCutoff = parseInt opts.unusedAttrsVertical\n\n if not isNaN(unusedAttrsVerticalAutoCutoff)\n attrLength = 0\n attrLength += a.length for a in shownInDragDrop\n unusedAttrsVerticalAutoOverride = attrLength > unusedAttrsVerticalAutoCutoff\n\n if opts.unusedAttrsVertical == true or unusedAttrsVerticalAutoOverride\n unused.addClass('pvtVertList')\n else\n unused.addClass('pvtHorizList')\n\n for own i, attr of shownInDragDrop\n do (attr) ->\n values = (v for v of attrValues[attr])\n hasExcludedItem = false\n valueList = $(\"
\").addClass('pvtFilterBox').hide()\n\n valueList.append $(\"

\").append(\n $(\"\").text(attr),\n $(\"\").addClass(\"count\").text(\"(#{values.length})\"),\n )\n if values.length > opts.menuLimit\n valueList.append $(\"

\").html(opts.localeStrings.tooMany)\n else\n if values.length > 5\n controls = $(\"

\").appendTo(valueList)\n sorter = getSort(opts.sorters, attr)\n placeholder = opts.localeStrings.filterResults\n $(\"\", {type: \"text\"}).appendTo(controls)\n .attr({placeholder: placeholder, class: \"pvtSearch\"})\n .bind \"keyup\", ->\n filter = $(this).val().toLowerCase().trim()\n accept_gen = (prefix, accepted) -> (v) ->\n real_filter = filter.substring(prefix.length).trim()\n return true if real_filter.length == 0\n return Math.sign(sorter(v.toLowerCase(), real_filter)) in accepted\n accept =\n if filter.indexOf(\">=\") == 0 then accept_gen(\">=\", [1,0])\n else if filter.indexOf(\"<=\") == 0 then accept_gen(\"<=\", [-1,0])\n else if filter.indexOf(\">\") == 0 then accept_gen(\">\", [1])\n else if filter.indexOf(\"<\") == 0 then accept_gen(\"<\", [-1])\n else if filter.indexOf(\"~\") == 0 then (v) ->\n return true if filter.substring(1).trim().length == 0\n v.toLowerCase().match(filter.substring(1))\n else (v) -> v.toLowerCase().indexOf(filter) != -1\n\n valueList.find('.pvtCheckContainer p label span.value').each ->\n if accept($(this).text())\n $(this).parent().parent().show()\n else\n $(this).parent().parent().hide()\n controls.append $(\"
\")\n $(\"

\").addClass('pvtVals pvtUiCell')\n .appendTo(tr1)\n .append(aggregator)\n .append(rowOrderArrow)\n .append(colOrderArrow)\n .append($(\"
\"))\n\n #column axes\n $(\"
\").addClass('pvtAxisContainer pvtHorizList pvtCols pvtUiCell').appendTo(tr1)\n\n tr2 = $(\"
\").addClass('pvtAxisContainer pvtRows pvtUiCell').attr(\"valign\", \"top\")\n\n #the actual pivot table container\n pivotTable = $(\"\")\n .attr(\"valign\", \"top\")\n .addClass('pvtRendererArea')\n .appendTo(tr2)\n\n #finally the renderer dropdown and unused attribs are inserted at the requested location\n if opts.unusedAttrsVertical == true or unusedAttrsVerticalAutoOverride\n uiTable.find('tr:nth-child(1)').prepend rendererControl\n uiTable.find('tr:nth-child(2)').prepend unused\n else\n uiTable.prepend $(\"
",{"class":"pvtUi"}).attr("cellpadding",5),B=t("").appendTo(Y),u=t("").appendTo(Y),Q.append(t("").append(B).append(X)),this.html(Y),q=M.cols,D=0,T=q.length;Dp;et=0<=p?++g:--g){for(i=t("
").addClass("pvtUiCell"),H=t("").addClass("pvtAxisContainer pvtUnused pvtUiCell"),J=function(){var t;t=[];for(s in m)e.call(M.hiddenAttributes,s)<0&&t.push(s);return t}(),G=function(){var t,n,r;for(r=[],t=0,n=J.length;tZ}M.unusedAttrsVertical===!0||tt?X.addClass("pvtVertList"):X.addClass("pvtHorizList"),w=function(n){var r,a,o,i,l,s,u,c,d,p,f,g,v,b,C,y,w,x,S;if(S=function(){var t;t=[];for(C in m[n])t.push(C);return t}(),c=!1,x=t("
").addClass("pvtFilterBox").hide(),x.append(t("

").append(t("").text(n),t("").addClass("count").text("("+S.length+")"))),S.length>M.menuLimit)x.append(t("

").html(M.localeStrings.tooMany));else for(S.length>5&&(i=t("

").appendTo(x),v=h(M.sorters,n),f=M.localeStrings.filterResults,t("",{type:"text"}).appendTo(i).attr({placeholder:f,"class":"pvtSearch"}).bind("keyup",function(){var n,r,a;return a=t(this).val().toLowerCase().trim(),r=function(t,n){return function(r){var o,i;return o=a.substring(t.length).trim(),0===o.length||(i=Math.sign(v(r.toLowerCase(),o)),e.call(n,i)>=0)}},n=0===a.indexOf(">=")?r(">=",[1,0]):0===a.indexOf("<=")?r("<=",[-1,0]):0===a.indexOf(">")?r(">",[1]):0===a.indexOf("<")?r("<",[-1]):0===a.indexOf("~")?function(t){return 0===a.substring(1).trim().length||t.toLowerCase().match(a.substring(1))}:function(t){return t.toLowerCase().indexOf(a)!==-1},x.find(".pvtCheckContainer p label span.value").each(function(){return n(t(this).text())?t(this).parent().parent().show():t(this).parent().parent().hide()})}),i.append(t("
")),t("

").addClass("pvtVals pvtUiCell").appendTo($).append(u).append(P).append(v).append(t("
")),t("
").addClass("pvtAxisContainer pvtHorizList pvtCols pvtUiCell").appendTo($),Q=t("
").addClass("pvtAxisContainer pvtRows pvtUiCell").attr("valign","top")),I=t("").attr("valign","top").addClass("pvtRendererArea").appendTo(Q),M.unusedAttrsVertical===!0||tt?(Y.find("tr:nth-child(1)").prepend(B),Y.find("tr:nth-child(2)").prepend(X)):Y.prepend(t("
",{"class":"pvtUi"}).attr("cellpadding",5),B=t("").appendTo(Y),u=t("").appendTo(Y),Q.append(t("").append(B).append(X)),this.html(Y),q=D.cols,L=0,T=q.length;Lp;et=0<=p?++g:--g){for(i=t("
").addClass("pvtUiCell"),H=t("").addClass("pvtAxisContainer pvtUnused pvtUiCell"),J=function(){var t;t=[];for(s in m)e.call(D.hiddenAttributes,s)<0&&t.push(s);return t}(),G=function(){var t,n,r;for(r=[],t=0,n=J.length;tZ}D.unusedAttrsVertical===!0||tt?X.addClass("pvtVertList"):X.addClass("pvtHorizList"),w=function(n){var r,a,o,i,l,s,u,c,d,p,f,g,v,b,C,y,w,x,S;if(S=function(){var t;t=[];for(C in m[n])t.push(C);return t}(),c=!1,x=t("
").addClass("pvtFilterBox").hide(),x.append(t("

").append(t("").text(n),t("").addClass("count").text("("+S.length+")"))),S.length>D.menuLimit)x.append(t("

").html(D.localeStrings.tooMany));else for(S.length>5&&(i=t("

").appendTo(x),v=h(D.sorters,n),f=D.localeStrings.filterResults,t("",{type:"text"}).appendTo(i).attr({placeholder:f,"class":"pvtSearch"}).bind("keyup",function(){var n,r,a;return a=t(this).val().toLowerCase().trim(),r=function(t,n){return function(r){var o,i;return o=a.substring(t.length).trim(),0===o.length||(i=Math.sign(v(r.toLowerCase(),o)),e.call(n,i)>=0)}},n=0===a.indexOf(">=")?r(">=",[1,0]):0===a.indexOf("<=")?r("<=",[-1,0]):0===a.indexOf(">")?r(">",[1]):0===a.indexOf("<")?r("<",[-1]):0===a.indexOf("~")?function(t){return 0===a.substring(1).trim().length||t.toLowerCase().match(a.substring(1))}:function(t){return t.toLowerCase().indexOf(a)!==-1},x.find(".pvtCheckContainer p label span.value").each(function(){return n(t(this).text())?t(this).parent().parent().show():t(this).parent().parent().hide()})}),i.append(t("
")),t("

").addClass("pvtVals pvtUiCell").appendTo($).append(u).append(P).append(v).append(t("
")),t("
").addClass("pvtAxisContainer pvtHorizList pvtCols pvtUiCell").appendTo($),Q=t("
").addClass("pvtAxisContainer pvtRows pvtUiCell").attr("valign","top")),M=t("").attr("valign","top").addClass("pvtRendererArea").appendTo(Q),D.unusedAttrsVertical===!0||tt?(Y.find("tr:nth-child(1)").prepend(B),Y.find("tr:nth-child(2)").prepend(X)):Y.prepend(t("
\", \"class\": \"pvtUi\").attr(\"cellpadding\", 5)\n\n #renderer control\n rendererControl = $(\"\").appendTo(uiTable)\n\n #aggregator menu and value area\n\n aggregator = $(\"\").appendTo(uiTable)\n\n #row axes\n tr2.append $(\"\").append(rendererControl).append(unused)\n\n #render the UI in its default state\n @html uiTable\n\n #set up the UI initial state as requested by moving elements around\n\n for x in opts.cols\n @find(\".pvtCols\").append @find(\".axis_#{$.inArray(x, shownInDragDrop)}\")\n for x in opts.rows\n @find(\".pvtRows\").append @find(\".axis_#{$.inArray(x, shownInDragDrop)}\")\n if opts.aggregatorName?\n @find(\".pvtAggregator\").val opts.aggregatorName\n if opts.rendererName?\n @find(\".pvtRenderer\").val opts.rendererName\n\n @find(\".pvtUiCell\").hide() unless opts.showUI\n\n initialRender = true\n\n #set up for refreshing\n refreshDelayed = =>\n subopts =\n derivedAttributes: opts.derivedAttributes\n localeStrings: opts.localeStrings\n rendererOptions: opts.rendererOptions\n sorters: opts.sorters\n cols: [], rows: []\n dataClass: opts.dataClass\n\n numInputsToProcess = opts.aggregators[aggregator.val()]([])().numInputs ? 0\n vals = []\n @find(\".pvtRows li span.pvtAttr\").each -> subopts.rows.push $(this).data(\"attrName\")\n @find(\".pvtCols li span.pvtAttr\").each -> subopts.cols.push $(this).data(\"attrName\")\n @find(\".pvtVals select.pvtAttrDropdown\").each ->\n if numInputsToProcess == 0\n $(this).remove()\n else\n numInputsToProcess--\n vals.push $(this).val() if $(this).val() != \"\"\n\n if numInputsToProcess != 0\n pvtVals = @find(\".pvtVals\")\n for x in [0...numInputsToProcess]\n newDropdown = $(\"
\").addClass(\"pvtUiCell\")\n\n renderer = $(\"\").addClass('pvtAxisContainer pvtUnused pvtUiCell')\n shownAttributes = (a for a of attrValues when a not in opts.hiddenAttributes)\n shownInAggregators = (c for c in shownAttributes when c not in opts.hiddenFromAggregators)\n shownInDragDrop = (c for c in shownAttributes when c not in opts.hiddenFromDragDrop)\n\n\n unusedAttrsVerticalAutoOverride = false\n if opts.unusedAttrsVertical == \"auto\"\n unusedAttrsVerticalAutoCutoff = 120 # legacy support\n else\n unusedAttrsVerticalAutoCutoff = parseInt opts.unusedAttrsVertical\n\n if not isNaN(unusedAttrsVerticalAutoCutoff)\n attrLength = 0\n attrLength += a.length for a in shownInDragDrop\n unusedAttrsVerticalAutoOverride = attrLength > unusedAttrsVerticalAutoCutoff\n\n if opts.unusedAttrsVertical == true or unusedAttrsVerticalAutoOverride\n unused.addClass('pvtVertList')\n else\n unused.addClass('pvtHorizList')\n\n for own i, attr of shownInDragDrop\n do (attr) ->\n values = (v for v of attrValues[attr])\n hasExcludedItem = false\n valueList = $(\"
\").addClass('pvtFilterBox').hide()\n\n valueList.append $(\"

\").append(\n $(\"\").text(attr),\n $(\"\").addClass(\"count\").text(\"(#{values.length})\"),\n )\n if values.length > opts.menuLimit\n valueList.append $(\"

\").html(opts.localeStrings.tooMany)\n else\n if values.length > 5\n controls = $(\"

\").appendTo(valueList)\n sorter = getSort(opts.sorters, attr)\n placeholder = opts.localeStrings.filterResults\n $(\"\", {type: \"text\"}).appendTo(controls)\n .attr({placeholder: placeholder, class: \"pvtSearch\"})\n .bind \"keyup\", ->\n filter = $(this).val().toLowerCase().trim()\n accept_gen = (prefix, accepted) -> (v) ->\n real_filter = filter.substring(prefix.length).trim()\n return true if real_filter.length == 0\n return Math.sign(sorter(v.toLowerCase(), real_filter)) in accepted\n accept =\n if filter.indexOf(\">=\") == 0 then accept_gen(\">=\", [1,0])\n else if filter.indexOf(\"<=\") == 0 then accept_gen(\"<=\", [-1,0])\n else if filter.indexOf(\">\") == 0 then accept_gen(\">\", [1])\n else if filter.indexOf(\"<\") == 0 then accept_gen(\"<\", [-1])\n else if filter.indexOf(\"~\") == 0 then (v) ->\n return true if filter.substring(1).trim().length == 0\n v.toLowerCase().match(filter.substring(1))\n else (v) -> v.toLowerCase().indexOf(filter) != -1\n\n valueList.find('.pvtCheckContainer p label span.value').each ->\n if accept($(this).text())\n $(this).parent().parent().show()\n else\n $(this).parent().parent().hide()\n controls.append $(\"
\")\n $(\"

\").addClass('pvtVals pvtUiCell')\n .appendTo(tr1)\n .append(aggregator)\n .append(rowOrderArrow)\n .append(colOrderArrow)\n .append($(\"
\"))\n\n #column axes\n $(\"
\").addClass('pvtAxisContainer pvtHorizList pvtCols pvtUiCell').appendTo(tr1)\n\n tr2 = $(\"
\").addClass('pvtAxisContainer pvtRows pvtUiCell').attr(\"valign\", \"top\")\n\n #the actual pivot table container\n pivotTable = $(\"\")\n .attr(\"valign\", \"top\")\n .addClass('pvtRendererArea')\n .appendTo(tr2)\n\n #finally the renderer dropdown and unused attribs are inserted at the requested location\n if opts.unusedAttrsVertical == true or unusedAttrsVerticalAutoOverride\n uiTable.find('tr:nth-child(1)').prepend rendererControl\n uiTable.find('tr:nth-child(2)').prepend unused\n else\n uiTable.prepend $(\"
\", {\n \"class\": \"pvtUi\"\n }).attr(\"cellpadding\", 5);\n rendererControl = $(\"\").appendTo(uiTable);\n aggregator = $(\"\").appendTo(uiTable);\n tr2.append($(\"\").append(rendererControl).append(unused));\n }\n this.html(uiTable);\n ref2 = opts.cols;\n for (n = 0, len2 = ref2.length; n < len2; n++) {\n x = ref2[n];\n this.find(\".pvtCols\").append(this.find(\".axis_\" + ($.inArray(x, shownInDragDrop))));\n }\n ref3 = opts.rows;\n for (o = 0, len3 = ref3.length; o < len3; o++) {\n x = ref3[o];\n this.find(\".pvtRows\").append(this.find(\".axis_\" + ($.inArray(x, shownInDragDrop))));\n }\n if (opts.aggregatorName != null) {\n this.find(\".pvtAggregator\").val(opts.aggregatorName);\n }\n if (opts.rendererName != null) {\n this.find(\".pvtRenderer\").val(opts.rendererName);\n }\n if (!opts.showUI) {\n this.find(\".pvtUiCell\").hide();\n }\n initialRender = true;\n refreshDelayed = (function(_this) {\n return function() {\n var exclusions, inclusions, len4, newDropdown, numInputsToProcess, pivotUIOptions, pvtVals, ref4, ref5, subopts, t, u, unusedAttrsContainer, vals;\n subopts = {\n derivedAttributes: opts.derivedAttributes,\n localeStrings: opts.localeStrings,\n rendererOptions: opts.rendererOptions,\n sorters: opts.sorters,\n cols: [],\n rows: [],\n dataClass: opts.dataClass\n };\n numInputsToProcess = (ref4 = opts.aggregators[aggregator.val()]([])().numInputs) != null ? ref4 : 0;\n vals = [];\n _this.find(\".pvtRows li span.pvtAttr\").each(function() {\n return subopts.rows.push($(this).data(\"attrName\"));\n });\n _this.find(\".pvtCols li span.pvtAttr\").each(function() {\n return subopts.cols.push($(this).data(\"attrName\"));\n });\n _this.find(\".pvtVals select.pvtAttrDropdown\").each(function() {\n if (numInputsToProcess === 0) {\n return $(this).remove();\n } else {\n numInputsToProcess--;\n if ($(this).val() !== \"\") {\n return vals.push($(this).val());\n }\n }\n });\n if (numInputsToProcess !== 0) {\n pvtVals = _this.find(\".pvtVals\");\n for (x = t = 0, ref5 = numInputsToProcess; 0 <= ref5 ? t < ref5 : t > ref5; x = 0 <= ref5 ? ++t : --t) {\n newDropdown = $(\"
\").addClass(\"pvtUiCell\");\n renderer = $(\"\").addClass('pvtAxisContainer pvtUnused pvtUiCell');\n shownAttributes = (function() {\n var results;\n results = [];\n for (a in attrValues) {\n if (indexOf.call(opts.hiddenAttributes, a) < 0) {\n results.push(a);\n }\n }\n return results;\n })();\n shownInAggregators = (function() {\n var l, len1, results;\n results = [];\n for (l = 0, len1 = shownAttributes.length; l < len1; l++) {\n c = shownAttributes[l];\n if (indexOf.call(opts.hiddenFromAggregators, c) < 0) {\n results.push(c);\n }\n }\n return results;\n })();\n shownInDragDrop = (function() {\n var l, len1, results;\n results = [];\n for (l = 0, len1 = shownAttributes.length; l < len1; l++) {\n c = shownAttributes[l];\n if (indexOf.call(opts.hiddenFromDragDrop, c) < 0) {\n results.push(c);\n }\n }\n return results;\n })();\n unusedAttrsVerticalAutoOverride = false;\n if (opts.unusedAttrsVertical === \"auto\") {\n unusedAttrsVerticalAutoCutoff = 120;\n } else {\n unusedAttrsVerticalAutoCutoff = parseInt(opts.unusedAttrsVertical);\n }\n if (!isNaN(unusedAttrsVerticalAutoCutoff)) {\n attrLength = 0;\n for (l = 0, len1 = shownInDragDrop.length; l < len1; l++) {\n a = shownInDragDrop[l];\n attrLength += a.length;\n }\n unusedAttrsVerticalAutoOverride = attrLength > unusedAttrsVerticalAutoCutoff;\n }\n if (opts.unusedAttrsVertical === true || unusedAttrsVerticalAutoOverride) {\n unused.addClass('pvtVertList');\n } else {\n unused.addClass('pvtHorizList');\n }\n fn1 = function(attr) {\n var attrElem, checkContainer, closeFilterBox, controls, filterItem, filterItemExcluded, finalButtons, hasExcludedItem, len2, n, placeholder, ref1, sorter, triangleLink, v, value, valueCount, valueList, values;\n values = (function() {\n var results;\n results = [];\n for (v in attrValues[attr]) {\n results.push(v);\n }\n return results;\n })();\n hasExcludedItem = false;\n valueList = $(\"
\").addClass('pvtFilterBox').hide();\n valueList.append($(\"

\").append($(\"\").text(attr), $(\"\").addClass(\"count\").text(\"(\" + values.length + \")\")));\n if (values.length > opts.menuLimit) {\n valueList.append($(\"

\").html(opts.localeStrings.tooMany));\n } else {\n if (values.length > 5) {\n controls = $(\"

\").appendTo(valueList);\n sorter = getSort(opts.sorters, attr);\n placeholder = opts.localeStrings.filterResults;\n $(\"\", {\n type: \"text\"\n }).appendTo(controls).attr({\n placeholder: placeholder,\n \"class\": \"pvtSearch\"\n }).bind(\"keyup\", function() {\n var accept, accept_gen, filter;\n filter = $(this).val().toLowerCase().trim();\n accept_gen = function(prefix, accepted) {\n return function(v) {\n var real_filter, ref1;\n real_filter = filter.substring(prefix.length).trim();\n if (real_filter.length === 0) {\n return true;\n }\n return ref1 = Math.sign(sorter(v.toLowerCase(), real_filter)), indexOf.call(accepted, ref1) >= 0;\n };\n };\n accept = filter.indexOf(\">=\") === 0 ? accept_gen(\">=\", [1, 0]) : filter.indexOf(\"<=\") === 0 ? accept_gen(\"<=\", [-1, 0]) : filter.indexOf(\">\") === 0 ? accept_gen(\">\", [1]) : filter.indexOf(\"<\") === 0 ? accept_gen(\"<\", [-1]) : filter.indexOf(\"~\") === 0 ? function(v) {\n if (filter.substring(1).trim().length === 0) {\n return true;\n }\n return v.toLowerCase().match(filter.substring(1));\n } : function(v) {\n return v.toLowerCase().indexOf(filter) !== -1;\n };\n return valueList.find('.pvtCheckContainer p label span.value').each(function() {\n if (accept($(this).text())) {\n return $(this).parent().parent().show();\n } else {\n return $(this).parent().parent().hide();\n }\n });\n });\n controls.append($(\"
\"));\n $(\"

\").addClass('pvtVals pvtUiCell').appendTo(tr1).append(aggregator).append(rowOrderArrow).append(colOrderArrow).append($(\"
\"));\n $(\"
\").addClass('pvtAxisContainer pvtHorizList pvtCols pvtUiCell').appendTo(tr1);\n tr2 = $(\"
\").addClass('pvtAxisContainer pvtRows pvtUiCell').attr(\"valign\", \"top\"));\n pivotTable = $(\"\").attr(\"valign\", \"top\").addClass('pvtRendererArea').appendTo(tr2);\n if (opts.unusedAttrsVertical === true || unusedAttrsVerticalAutoOverride) {\n uiTable.find('tr:nth-child(1)').prepend(rendererControl);\n uiTable.find('tr:nth-child(2)').prepend(unused);\n } else {\n uiTable.prepend($(\"
\", \"class\": \"pvtUi\").attr(\"cellpadding\", 5)\n\n #renderer control\n rendererControl = $(\"\").appendTo(uiTable)\n\n #aggregator menu and value area\n\n aggregator = $(\"\").appendTo(uiTable)\n\n #row axes\n tr2.append $(\"\").append(rendererControl).append(unused)\n\n #render the UI in its default state\n @html uiTable\n\n #set up the UI initial state as requested by moving elements around\n\n for x in opts.cols\n @find(\".pvtCols\").append @find(\".axis_#{$.inArray(x, shownInDragDrop)}\")\n for x in opts.rows\n @find(\".pvtRows\").append @find(\".axis_#{$.inArray(x, shownInDragDrop)}\")\n if opts.aggregatorName?\n @find(\".pvtAggregator\").val opts.aggregatorName\n if opts.rendererName?\n @find(\".pvtRenderer\").val opts.rendererName\n\n @find(\".pvtUiCell\").hide() unless opts.showUI\n\n initialRender = true\n\n #set up for refreshing\n refreshDelayed = =>\n subopts =\n derivedAttributes: opts.derivedAttributes\n localeStrings: opts.localeStrings\n rendererOptions: opts.rendererOptions\n sorters: opts.sorters\n cols: [], rows: []\n dataClass: opts.dataClass\n\n numInputsToProcess = opts.aggregators[aggregator.val()]([])().numInputs ? 0\n vals = []\n @find(\".pvtRows li span.pvtAttr\").each -> subopts.rows.push $(this).data(\"attrName\")\n @find(\".pvtCols li span.pvtAttr\").each -> subopts.cols.push $(this).data(\"attrName\")\n @find(\".pvtVals select.pvtAttrDropdown\").each ->\n if numInputsToProcess == 0\n $(this).remove()\n else\n numInputsToProcess--\n vals.push $(this).val() if $(this).val() != \"\"\n\n if numInputsToProcess != 0\n pvtVals = @find(\".pvtVals\")\n for x in [0...numInputsToProcess]\n newDropdown = $(\"
\").addClass(\"pvtUiCell\")\n\n renderer = $(\"\").addClass('pvtAxisContainer pvtUnused pvtUiCell')\n shownAttributes = (a for a of attrValues when a not in opts.hiddenAttributes)\n shownInAggregators = (c for c in shownAttributes when c not in opts.hiddenFromAggregators)\n shownInDragDrop = (c for c in shownAttributes when c not in opts.hiddenFromDragDrop)\n\n\n unusedAttrsVerticalAutoOverride = false\n if opts.unusedAttrsVertical == \"auto\"\n unusedAttrsVerticalAutoCutoff = 120 # legacy support\n else\n unusedAttrsVerticalAutoCutoff = parseInt opts.unusedAttrsVertical\n\n if not isNaN(unusedAttrsVerticalAutoCutoff)\n attrLength = 0\n attrLength += a.length for a in shownInDragDrop\n unusedAttrsVerticalAutoOverride = attrLength > unusedAttrsVerticalAutoCutoff\n\n if opts.unusedAttrsVertical == true or unusedAttrsVerticalAutoOverride\n unused.addClass('pvtVertList')\n else\n unused.addClass('pvtHorizList')\n\n for own i, attr of shownInDragDrop\n do (attr) ->\n values = (v for v of attrValues[attr])\n hasExcludedItem = false\n valueList = $(\"
\").addClass('pvtFilterBox').hide()\n\n valueList.append $(\"

\").append(\n $(\"\").text(attr),\n $(\"\").addClass(\"count\").text(\"(#{values.length})\"),\n )\n if values.length > opts.menuLimit\n valueList.append $(\"

\").html(opts.localeStrings.tooMany)\n else\n if values.length > 5\n controls = $(\"

\").appendTo(valueList)\n sorter = getSort(opts.sorters, attr)\n placeholder = opts.localeStrings.filterResults\n $(\"\", {type: \"text\"}).appendTo(controls)\n .attr({placeholder: placeholder, class: \"pvtSearch\"})\n .bind \"keyup\", ->\n filter = $(this).val().toLowerCase().trim()\n accept_gen = (prefix, accepted) -> (v) ->\n real_filter = filter.substring(prefix.length).trim()\n return true if real_filter.length == 0\n return Math.sign(sorter(v.toLowerCase(), real_filter)) in accepted\n accept =\n if filter.indexOf(\">=\") == 0 then accept_gen(\">=\", [1,0])\n else if filter.indexOf(\"<=\") == 0 then accept_gen(\"<=\", [-1,0])\n else if filter.indexOf(\">\") == 0 then accept_gen(\">\", [1])\n else if filter.indexOf(\"<\") == 0 then accept_gen(\"<\", [-1])\n else if filter.indexOf(\"~\") == 0 then (v) ->\n return true if filter.substring(1).trim().length == 0\n v.toLowerCase().match(filter.substring(1))\n else (v) -> v.toLowerCase().indexOf(filter) != -1\n\n valueList.find('.pvtCheckContainer p label span.value').each ->\n if accept($(this).text())\n $(this).parent().parent().show()\n else\n $(this).parent().parent().hide()\n controls.append $(\"
\")\n $(\"

\").addClass('pvtVals pvtUiCell')\n .appendTo(tr1)\n .append(aggregator)\n .append(rowOrderArrow)\n .append(colOrderArrow)\n .append($(\"
\"))\n\n #column axes\n $(\"
\").addClass('pvtAxisContainer pvtHorizList pvtCols pvtUiCell').appendTo(tr1)\n\n tr2 = $(\"
\").addClass('pvtAxisContainer pvtRows pvtUiCell').attr(\"valign\", \"top\")\n\n #the actual pivot table container\n pivotTable = $(\"\")\n .attr(\"valign\", \"top\")\n .addClass('pvtRendererArea')\n .appendTo(tr2)\n\n #finally the renderer dropdown and unused attribs are inserted at the requested location\n if opts.unusedAttrsVertical == true or unusedAttrsVerticalAutoOverride\n uiTable.find('tr:nth-child(1)').prepend rendererControl\n uiTable.find('tr:nth-child(2)').prepend unused\n else\n uiTable.prepend $(\"
\", {\n \"class\": \"pvtUi\"\n }).attr(\"cellpadding\", 5);\n rendererControl = $(\"\").appendTo(uiTable);\n aggregator = $(\"\").appendTo(uiTable);\n tr2.append($(\"\").append(rendererControl).append(unused));\n }\n this.html(uiTable);\n ref2 = opts.cols;\n for (n = 0, len2 = ref2.length; n < len2; n++) {\n x = ref2[n];\n this.find(\".pvtCols\").append(this.find(\".axis_\" + ($.inArray(x, shownInDragDrop))));\n }\n ref3 = opts.rows;\n for (o = 0, len3 = ref3.length; o < len3; o++) {\n x = ref3[o];\n this.find(\".pvtRows\").append(this.find(\".axis_\" + ($.inArray(x, shownInDragDrop))));\n }\n if (opts.aggregatorName != null) {\n this.find(\".pvtAggregator\").val(opts.aggregatorName);\n }\n if (opts.rendererName != null) {\n this.find(\".pvtRenderer\").val(opts.rendererName);\n }\n if (!opts.showUI) {\n this.find(\".pvtUiCell\").hide();\n }\n initialRender = true;\n refreshDelayed = (function(_this) {\n return function() {\n var exclusions, inclusions, len4, newDropdown, numInputsToProcess, pivotUIOptions, pvtVals, ref4, ref5, subopts, t, u, unusedAttrsContainer, vals;\n subopts = {\n derivedAttributes: opts.derivedAttributes,\n localeStrings: opts.localeStrings,\n rendererOptions: opts.rendererOptions,\n sorters: opts.sorters,\n cols: [],\n rows: [],\n dataClass: opts.dataClass\n };\n numInputsToProcess = (ref4 = opts.aggregators[aggregator.val()]([])().numInputs) != null ? ref4 : 0;\n vals = [];\n _this.find(\".pvtRows li span.pvtAttr\").each(function() {\n return subopts.rows.push($(this).data(\"attrName\"));\n });\n _this.find(\".pvtCols li span.pvtAttr\").each(function() {\n return subopts.cols.push($(this).data(\"attrName\"));\n });\n _this.find(\".pvtVals select.pvtAttrDropdown\").each(function() {\n if (numInputsToProcess === 0) {\n return $(this).remove();\n } else {\n numInputsToProcess--;\n if ($(this).val() !== \"\") {\n return vals.push($(this).val());\n }\n }\n });\n if (numInputsToProcess !== 0) {\n pvtVals = _this.find(\".pvtVals\");\n for (x = t = 0, ref5 = numInputsToProcess; 0 <= ref5 ? t < ref5 : t > ref5; x = 0 <= ref5 ? ++t : --t) {\n newDropdown = $(\"
\").addClass(\"pvtUiCell\");\n renderer = $(\"\").addClass('pvtAxisContainer pvtUnused pvtUiCell');\n shownAttributes = (function() {\n var results;\n results = [];\n for (a in attrValues) {\n if (indexOf.call(opts.hiddenAttributes, a) < 0) {\n results.push(a);\n }\n }\n return results;\n })();\n shownInAggregators = (function() {\n var l, len1, results;\n results = [];\n for (l = 0, len1 = shownAttributes.length; l < len1; l++) {\n c = shownAttributes[l];\n if (indexOf.call(opts.hiddenFromAggregators, c) < 0) {\n results.push(c);\n }\n }\n return results;\n })();\n shownInDragDrop = (function() {\n var l, len1, results;\n results = [];\n for (l = 0, len1 = shownAttributes.length; l < len1; l++) {\n c = shownAttributes[l];\n if (indexOf.call(opts.hiddenFromDragDrop, c) < 0) {\n results.push(c);\n }\n }\n return results;\n })();\n unusedAttrsVerticalAutoOverride = false;\n if (opts.unusedAttrsVertical === \"auto\") {\n unusedAttrsVerticalAutoCutoff = 120;\n } else {\n unusedAttrsVerticalAutoCutoff = parseInt(opts.unusedAttrsVertical);\n }\n if (!isNaN(unusedAttrsVerticalAutoCutoff)) {\n attrLength = 0;\n for (l = 0, len1 = shownInDragDrop.length; l < len1; l++) {\n a = shownInDragDrop[l];\n attrLength += a.length;\n }\n unusedAttrsVerticalAutoOverride = attrLength > unusedAttrsVerticalAutoCutoff;\n }\n if (opts.unusedAttrsVertical === true || unusedAttrsVerticalAutoOverride) {\n unused.addClass('pvtVertList');\n } else {\n unused.addClass('pvtHorizList');\n }\n fn1 = function(attr) {\n var attrElem, checkContainer, closeFilterBox, controls, filterItem, filterItemExcluded, finalButtons, hasExcludedItem, len2, n, placeholder, ref1, sorter, triangleLink, v, value, valueCount, valueList, values;\n values = (function() {\n var results;\n results = [];\n for (v in attrValues[attr]) {\n results.push(v);\n }\n return results;\n })();\n hasExcludedItem = false;\n valueList = $(\"
\").addClass('pvtFilterBox').hide();\n valueList.append($(\"

\").append($(\"\").text(attr), $(\"\").addClass(\"count\").text(\"(\" + values.length + \")\")));\n if (values.length > opts.menuLimit) {\n valueList.append($(\"

\").html(opts.localeStrings.tooMany));\n } else {\n if (values.length > 5) {\n controls = $(\"

\").appendTo(valueList);\n sorter = getSort(opts.sorters, attr);\n placeholder = opts.localeStrings.filterResults;\n $(\"\", {\n type: \"text\"\n }).appendTo(controls).attr({\n placeholder: placeholder,\n \"class\": \"pvtSearch\"\n }).bind(\"keyup\", function() {\n var accept, accept_gen, filter;\n filter = $(this).val().toLowerCase().trim();\n accept_gen = function(prefix, accepted) {\n return function(v) {\n var real_filter, ref1;\n real_filter = filter.substring(prefix.length).trim();\n if (real_filter.length === 0) {\n return true;\n }\n return ref1 = Math.sign(sorter(v.toLowerCase(), real_filter)), indexOf.call(accepted, ref1) >= 0;\n };\n };\n accept = filter.indexOf(\">=\") === 0 ? accept_gen(\">=\", [1, 0]) : filter.indexOf(\"<=\") === 0 ? accept_gen(\"<=\", [-1, 0]) : filter.indexOf(\">\") === 0 ? accept_gen(\">\", [1]) : filter.indexOf(\"<\") === 0 ? accept_gen(\"<\", [-1]) : filter.indexOf(\"~\") === 0 ? function(v) {\n if (filter.substring(1).trim().length === 0) {\n return true;\n }\n return v.toLowerCase().match(filter.substring(1));\n } : function(v) {\n return v.toLowerCase().indexOf(filter) !== -1;\n };\n return valueList.find('.pvtCheckContainer p label span.value').each(function() {\n if (accept($(this).text())) {\n return $(this).parent().parent().show();\n } else {\n return $(this).parent().parent().hide();\n }\n });\n });\n controls.append($(\"
\"));\n $(\"

\").addClass('pvtVals pvtUiCell').appendTo(tr1).append(aggregator).append(rowOrderArrow).append(colOrderArrow).append($(\"
\"));\n $(\"
\").addClass('pvtAxisContainer pvtHorizList pvtCols pvtUiCell').appendTo(tr1);\n tr2 = $(\"
\").addClass('pvtAxisContainer pvtRows pvtUiCell').attr(\"valign\", \"top\"));\n pivotTable = $(\"\").attr(\"valign\", \"top\").addClass('pvtRendererArea').appendTo(tr2);\n if (opts.unusedAttrsVertical === true || unusedAttrsVerticalAutoOverride) {\n uiTable.find('tr:nth-child(1)').prepend(rendererControl);\n uiTable.find('tr:nth-child(2)').prepend(unused);\n } else {\n uiTable.prepend($(\"