From 41a18145e7aedfca7ecb957be4298c2c03d3b8e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Sa=CC=81=20Pereira?= Date: Mon, 30 May 2022 20:04:56 +0100 Subject: [PATCH] Add support to sort key_z_to_a --- dist/pivot.js | 44 +++++++++++++++++++++++++++++++++++-------- dist/pivot.js.map | 2 +- dist/pivot.min.js | 2 +- dist/pivot.min.js.map | 2 +- src/pivot.coffee | 19 ++++++++++++++----- 5 files changed, 53 insertions(+), 16 deletions(-) diff --git a/dist/pivot.js b/dist/pivot.js index 489e412a..d6e77079 100644 --- a/dist/pivot.js +++ b/dist/pivot.js @@ -455,7 +455,11 @@ cancel: "Cancel", totals: "Totals", vs: "vs", - by: "by" + by: "by", + key_a_to_z: "Key A to Z", + key_z_to_a: "Key Z to A", + value_a_to_z: "Value A to Z", + value_z_to_a: "Value Z to A" } } }; @@ -794,6 +798,13 @@ }; })(this)); break; + case "key_z_to_a": + this.rowKeys.sort((function(_this) { + return function(a, b) { + return -naturalSort(a, b); + }; + })(this)); + break; default: this.rowKeys.sort(this.arrSort(this.rowAttrs)); } @@ -810,6 +821,12 @@ return -naturalSort(v([], a), v([], b)); }; })(this)); + case "key_z_to_a": + return this.colKeys.sort((function(_this) { + return function(a, b) { + return -naturalSort(a, b); + }; + })(this)); default: return this.colKeys.sort(this.arrSort(this.colAttrs)); } @@ -1482,33 +1499,44 @@ } ordering = { key_a_to_z: { - rowSymbol: "↕", - colSymbol: "↔", - next: "value_a_to_z" + rowSymbol: "⤓", + colSymbol: "⇥", + next: "key_z_to_a", + title: opts.localeStrings.key_a_to_z + }, + key_z_to_a: { + rowSymbol: "⤒", + colSymbol: "⇤", + next: "value_a_to_z", + title: opts.localeStrings.key_z_to_a }, value_a_to_z: { rowSymbol: "↓", colSymbol: "→", - next: "value_z_to_a" + next: "value_z_to_a", + title: opts.localeStrings.value_a_to_z }, value_z_to_a: { rowSymbol: "↑", colSymbol: "←", - next: "key_a_to_z" + next: "key_a_to_z", + title: opts.localeStrings.value_z_to_a } }; rowOrderArrow = $("", { role: "button" - }).addClass("pvtRowOrder").data("order", opts.rowOrder).html(ordering[opts.rowOrder].rowSymbol).bind("click", function() { + }).addClass("pvtRowOrder").data("order", opts.rowOrder).attr('title', ordering[opts.rowOrder].title).html(ordering[opts.rowOrder].rowSymbol).bind("click", function() { $(this).data("order", ordering[$(this).data("order")].next); $(this).html(ordering[$(this).data("order")].rowSymbol); + $(this).attr('title', ordering[$(this).data("order")].title); return refresh(); }); colOrderArrow = $("", { role: "button" - }).addClass("pvtColOrder").data("order", opts.colOrder).html(ordering[opts.colOrder].colSymbol).bind("click", function() { + }).addClass("pvtColOrder").data("order", opts.colOrder).attr('title', ordering[opts.colOrder].title).html(ordering[opts.colOrder].colSymbol).bind("click", function() { $(this).data("order", ordering[$(this).data("order")].next); $(this).html(ordering[$(this).data("order")].colSymbol); + $(this).attr('title', ordering[$(this).data("order")].title); return refresh(); }); $("").addClass('pvtVals pvtUiCell').appendTo(tr1).append(aggregator).append(rowOrderArrow).append(colOrderArrow).append($("
")); diff --git a/dist/pivot.js.map b/dist/pivot.js.map index a45720b3..6ae9022e 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;;EASjB,cAAA,CAAe,SAAC,CAAD;;AAEX;;;AAAA,QAAA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Aa,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),H=t("").appendTo(Q),u=t("").appendTo(Q),$.append(t("").append(H).append(Y)),this.html(Q),U=M.cols,D=0,N=U.length;Dp;et=0<=p?++g:--g){for(i=t("
").addClass("pvtUiCell"),B=t("").addClass("pvtAxisContainer pvtUnused pvtUiCell"),Z=function(){var t;t=[];for(s in m)e.call(M.hiddenAttributes,s)<0&&t.push(s);return t}(),J=function(){var t,n,r;for(r=[],t=0,n=Z.length;tX}M.unusedAttrsVertical===!0||tt?Y.addClass("pvtVertList"):Y.addClass("pvtHorizList"),w=function(n){var r,a,o,i,l,s,u,c,d,p,f,g,v,b,y,C,w,x,S;if(S=function(){var t;t=[];for(y in m[n])t.push(y);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(W).append(u).append(P).append(v).append(t("
")),t("
").addClass("pvtAxisContainer pvtHorizList pvtCols pvtUiCell").appendTo(W),$=t("
").addClass("pvtAxisContainer pvtRows pvtUiCell").attr("valign","top")),z=t("").attr("valign","top").addClass("pvtRendererArea").appendTo($),M.unusedAttrsVertical===!0||tt?(Q.find("tr:nth-child(1)").prepend(H),Q.find("tr:nth-child(2)").prepend(Y)):Q.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($(\"
").addClass('pvtVals pvtUiCell')