From 028932e53cf06ad9239b009f9186d27433dd03f4 Mon Sep 17 00:00:00 2001 From: Max Guglielmi Date: Sat, 8 Oct 2016 11:50:34 +1100 Subject: [PATCH] Expanded colOps extension tests --- dist/starter.html | 4 +- dist/tablefilter/style/colsVisibility.css | 4 +- dist/tablefilter/style/filtersVisibility.css | 4 +- dist/tablefilter/style/tablefilter.css | 4 +- .../style/themes/default/default.css | 4 +- .../style/themes/mytheme/mytheme.css | 4 +- .../style/themes/skyblue/skyblue.css | 4 +- dist/tablefilter/tablefilter.js | 6 +- dist/tablefilter/tf-1.js | 4 +- package.json | 2 +- test/test-col-ops.html | 30 ++- test/test-col-ops.js | 217 +++++++++++++++--- 12 files changed, 229 insertions(+), 58 deletions(-) diff --git a/dist/starter.html b/dist/starter.html index ce65407c..770dcf3b 100644 --- a/dist/starter.html +++ b/dist/starter.html @@ -1,10 +1,10 @@ - tablefilter v0.3.0 - Starter + tablefilter v0.3.1 - Starter -

tablefilter v0.3.0

+

tablefilter v0.3.1

diff --git a/dist/tablefilter/style/colsVisibility.css b/dist/tablefilter/style/colsVisibility.css index 092f2105..7a1fac50 100644 --- a/dist/tablefilter/style/colsVisibility.css +++ b/dist/tablefilter/style/colsVisibility.css @@ -1,6 +1,6 @@ /** - * tablefilter v0.3.0 by Max Guglielmi - * build date: 2016-10-03T05:58:32.902Z + * tablefilter v0.3.1 by Max Guglielmi + * build date: 2016-10-08T00:44:54.788Z * MIT License */ span.colVisSpan{text-align:left;}span.colVisSpan a.colVis{display:inline-block;padding:7px 5px 0;font-size:inherit;font-weight:inherit;vertical-align:top}div.colVisCont{position:relative;background:#fff;-webkit-box-shadow:3px 3px 2px #888;-moz-box-shadow:3px 3px 2px #888;box-shadow:3px 3px 2px #888;position:absolute;display:none;border:1px solid #ccc;height:auto;width:250px;background-color:#fff;margin:35px 0 0 -100px;z-index:10000;padding:10px 10px 10px 10px;text-align:left;font-size:12px;}div.colVisCont:after,div.colVisCont:before{bottom:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}div.colVisCont:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}div.colVisCont:before{border-color:rgba(255,255,255,0);border-bottom-color:#ccc;border-width:12px;margin-left:-12px}div.colVisCont p{margin:6px auto 6px auto}div.colVisCont a.colVis{display:initial;font-weight:inherit}ul.cols_checklist{padding:0;margin:0;list-style:none;}ul.cols_checklist label{display:block}ul.cols_checklist input{vertical-align:middle;margin:2px 5px 2px 1px}li.cols_checklist_item{padding:4px;margin:0;}li.cols_checklist_item:hover{background-color:#335ea8;color:#fff}.cols_checklist_slc_item{background-color:#335ea8;color:#fff} \ No newline at end of file diff --git a/dist/tablefilter/style/filtersVisibility.css b/dist/tablefilter/style/filtersVisibility.css index dfbf8cc0..bf85d0c5 100644 --- a/dist/tablefilter/style/filtersVisibility.css +++ b/dist/tablefilter/style/filtersVisibility.css @@ -1,6 +1,6 @@ /** - * tablefilter v0.3.0 by Max Guglielmi - * build date: 2016-10-03T05:58:32.902Z + * tablefilter v0.3.1 by Max Guglielmi + * build date: 2016-10-08T00:44:54.788Z * MIT License */ span.expClpFlt a.btnExpClpFlt{width:35px;height:35px;display:inline-block;}span.expClpFlt a.btnExpClpFlt:hover{background-color:#f4f4f4}span.expClpFlt img{padding:8px 11px 11px 11px} \ No newline at end of file diff --git a/dist/tablefilter/style/tablefilter.css b/dist/tablefilter/style/tablefilter.css index 3ecdb294..365269c8 100644 --- a/dist/tablefilter/style/tablefilter.css +++ b/dist/tablefilter/style/tablefilter.css @@ -1,6 +1,6 @@ /** - * tablefilter v0.3.0 by Max Guglielmi - * build date: 2016-10-03T05:58:32.902Z + * tablefilter v0.3.1 by Max Guglielmi + * build date: 2016-10-08T00:44:54.788Z * MIT License */ .activeHeader{background-color:#66afe9 !important;color:#fff !important} diff --git a/dist/tablefilter/style/themes/default/default.css b/dist/tablefilter/style/themes/default/default.css index 07829d50..a1b4841a 100644 --- a/dist/tablefilter/style/themes/default/default.css +++ b/dist/tablefilter/style/themes/default/default.css @@ -1,6 +1,6 @@ /** - * tablefilter v0.3.0 by Max Guglielmi - * build date: 2016-10-03T05:58:32.902Z + * tablefilter v0.3.1 by Max Guglielmi + * build date: 2016-10-08T00:44:54.788Z * MIT License */ table.TF{border-left:1px solid #ccc;border-top:none;border-right:none;border-bottom:none;}table.TF th{background:#ebecee url("images/bg_th.jpg") left top repeat-x;border-bottom:1px solid #d0d0d0;border-right:1px solid #d0d0d0;border-left:1px solid #fff;border-top:1px solid #fff;color:#333}table.TF td{border-bottom:1px dotted #999;padding:5px}.fltrow{background-color:#ebecee !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #666 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #999 !important}input.flt{width:99% !important}.inf{height:$min-height;background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important}input.reset{background:transparent url("images/btn_eraser.gif") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;}.nextPage:hover{background:transparent url("images/btn_over_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important;}.previousPage:hover{background:transparent url("images/btn_over_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;}.firstPage:hover{background:transparent url("images/btn_over_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;}.lastPage:hover{background:transparent url("images/btn_over_last_page.gif") center center no-repeat !important}div.grd_Cont{background-color:#ebecee !important;border:1px solid #ccc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#d5d5d5}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important;}div.grd_headTblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #999 !important}.grd_inf{background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important;border-top:1px solid #d0d0d0 !important}.loader{border:1px solid #999}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#fff}.odd{background-color:#d5d5d5}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.activeHeader{background:#999 !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/mytheme/mytheme.css b/dist/tablefilter/style/themes/mytheme/mytheme.css index 48954411..fb8bddde 100644 --- a/dist/tablefilter/style/themes/mytheme/mytheme.css +++ b/dist/tablefilter/style/themes/mytheme/mytheme.css @@ -1,6 +1,6 @@ /** - * tablefilter v0.3.0 by Max Guglielmi - * build date: 2016-10-03T05:58:32.902Z + * tablefilter v0.3.1 by Max Guglielmi + * build date: 2016-10-08T00:44:54.788Z * MIT License */ table.TF{border-left:1px dotted #81963b;border-top:none;border-right:0;border-bottom:none;}table.TF th{background:#39424b url("images/bg_headers.jpg") left top repeat-x;border-bottom:0;border-right:1px dotted #d0d0d0;border-left:0;border-top:0;color:#fff}table.TF td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b;padding:5px}.fltrow{background-color:#81963b !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #687830 !important}input.flt{width:99% !important}.inf{background:#d8d8d8;height:$min-height}input.reset{width:53px;background:transparent url("images/btn_filter.png") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important}div.grd_Cont{background:#81963b url("images/bg_headers.jpg") left top repeat-x !important;border:1px solid #ccc !important;padding:0 1px 1px 1px !important;}div.grd_Cont .even{background-color:#bccd83}div.grd_Cont .odd{background-color:#fff}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important;}div.grd_tblCont table td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b}div.grd_tblCont table th,div.grd_headTblCont table th{background:transparent url("images/bg_headers.jpg") 0 0 repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;padding:0 4px 0 4px !important;color:#fff !important;height:35px !important}div.grd_headTblCont table td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;background-color:#81963b !important;padding:1px 3px 1px 3px !important}.grd_inf{background-color:#d8d8d8;border-top:1px solid #d0d0d0 !important}.loader{border:0 !important;background:#81963b !important}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#bccd83}.odd{background-color:#fff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.activeHeader{background:#81963b !important} \ No newline at end of file diff --git a/dist/tablefilter/style/themes/skyblue/skyblue.css b/dist/tablefilter/style/themes/skyblue/skyblue.css index 1f46f139..46523b70 100644 --- a/dist/tablefilter/style/themes/skyblue/skyblue.css +++ b/dist/tablefilter/style/themes/skyblue/skyblue.css @@ -1,6 +1,6 @@ /** - * tablefilter v0.3.0 by Max Guglielmi - * build date: 2016-10-03T05:58:32.902Z + * tablefilter v0.3.1 by Max Guglielmi + * build date: 2016-10-08T00:44:54.788Z * MIT License */ table.TF{padding:0;color:#000;border-right:1px solid #a4bed4;border-top:1px solid #a4bed4;border-left:1px solid #a4bed4;border-bottom:0;}table.TF th{margin:0;color:inherit;background:#d1e5fe url("images/bg_skyblue.gif") 0 0 repeat-x;border-color:#fdfdfd #a4bed4 #a4bed4 #fdfdfd;border-width:1px;border-style:solid}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid #a4bed4;border-left:0;border-top:0;border-right:0}.fltrow{background-color:#d1e5fe !important;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4 !important}input.flt{width:99% !important}.inf{background-color:#e3efff !important;border:1px solid #a4bed4;height:$min-height;color:#004a6f}div.tot,div.status{border-right:0 !important}.helpBtn:hover{background-color:transparent}input.reset{background:transparent url("images/icn_clear_filters.png") center center no-repeat !important}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.nextPage:hover{background:#ffe4ab url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#ffe4ab url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#ffe4ab url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#ffe4ab url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.activeHeader{background:#ffe4ab !important;border:1px solid #ffb552 !important;color:inherit !important}div.grd_Cont{background-color:#d9eaed !important;border:1px solid #9cc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#e3efff}div.grd_headTblCont{background-color:#d9eaed !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#d9eaed url("images/bg_skyblue.gif") left top repeat-x;border-bottom:1px solid #a4bed4;border-right:1px solid #a4bed4 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #a4bed4 !important;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:#cce2fe;color:#004a6f;border-top:1px solid #9cc !important;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#2d8eef;border:1px solid #cce2fe;border-radius:5px}.even{background-color:#fff}.odd{background-color:#e3efff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ffdc61 !important;color:inherit}.ezSelectedRow{background-color:#ffe4ab !important;color:inherit}.ezActiveCell{background-color:#fff !important;color:#000 !important;font-weight:bold}.ezETSelectedCell{background-color:#fff !important;font-weight:bold;color:#000 !important} \ No newline at end of file diff --git a/dist/tablefilter/tablefilter.js b/dist/tablefilter/tablefilter.js index 145e50d9..758269ed 100644 --- a/dist/tablefilter/tablefilter.js +++ b/dist/tablefilter/tablefilter.js @@ -1,10 +1,10 @@ /** - * tablefilter v0.3.0 by Max Guglielmi - * build date: 2016-10-03T05:58:32.886Z + * tablefilter v0.3.1 by Max Guglielmi + * build date: 2016-10-08T00:44:54.619Z * MIT License */ -!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var n in i)("object"==typeof exports?exports:t)[n]=i[n]}}(this,function(){return function(t){function e(i){if(n[i])return n[i].exports;var s=n[i]={exports:{},id:i,loaded:!1};return t[i].call(s.exports,s,s.exports,e),s.loaded=!0,s.exports}var i=window.webpackJsonp;window.webpackJsonp=function(n,r){for(var a,o,l=0,u=[];l",this.lwOperator=c.lower_operator||"<",this.leOperator=c.lower_equal_operator||"<=",this.geOperator=c.greater_equal_operator||">=",this.dfOperator=c.different_operator||"!",this.lkOperator=c.like_operator||"*",this.eqOperator=c.equal_operator||"=",this.stOperator=c.start_with_operator||"{",this.enOperator=c.end_with_operator||"}",this.separator=c.separator||",",this.rowsCounter=Boolean(c.rows_counter),this.statusBar=Boolean(c.status_bar),this.loader=Boolean(c.loader),this.displayBtn=Boolean(c.btn),this.btnText=c.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=c.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(c.btn_reset),this.onBeforeReset=(0,l.isFn)(c.on_before_reset)?c.on_before_reset:null,this.onAfterReset=(0,l.isFn)(c.on_after_reset)?c.on_after_reset:null,this.paging=Boolean(c.paging),this.nbHiddenRows=0,this.autoFilter=Boolean(c.auto_filter),this.autoFilterDelay=isNaN(c.auto_filter_delay)?S.AUTO_FILTER_DELAY:c.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(c.highlight_keywords),this.noResults=(0,l.isObj)(c.no_results_message)||Boolean(c.no_results_message),this.state=(0,l.isObj)(c.state)||Boolean(c.state),this.locale=c.locale||"en",this.thousandsSeparator=c.thousands_separator||",",this.decimalSeparator=c.decimal_separator||".",this.hasColTypes=(0,l.isArray)(c.col_types),this.colTypes=this.hasColTypes?c.col_types:[],this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxResponsive="resp",this.extensions=c.extensions,this.hasExtensions=(0,l.isArray)(this.extensions),this.enableDefaultTheme=Boolean(c.enable_default_theme),this.hasThemes=this.enableDefaultTheme||(0,l.isArray)(c.themes),this.themes=c.themes||[],this.themesPath=c.themes_path||this.stylePath+"themes/",this.responsive=Boolean(c.responsive),this.Mod={},this.ExtRegistry={}}return t.prototype.init=function(){var t=this;if(!this.initialized){var e=this.Mod,i=this.singleSearchFlt?1:this.nbCells,n=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this.loadThemes(),e.dateType||(e.dateType=new k.DateType(this),e.dateType.init()),e.help||(e.help=new w.Help(this)),this.help&&e.help.init(),this.state&&(e.state||(e.state=new T.State(this)),e.state.init()),this.gridLayout&&(e.gridLayout||(e.gridLayout=new h.GridLayout(this)),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new d.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new p.HighlightKeyword(this),e.highlightKeyword.init()),this.popupFilters&&(e.popupFilter||(e.popupFilter=new m.PopupFilter(this)),e.popupFilter.init()),this.fltGrid){var s=this._insertFiltersRow();this.nbFilterableRows=this.getRowsNb();for(var r=0;r0?e[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),t.className=this.fltsRowCssClass,this.isExternalFlt&&(t.style.display=S.NONE),this.emitter.emit("filters-row-inserted",this,t),t}},t.prototype._initNoFilters=function(){this.fltGrid||(this.refRow=this.refRow>0?this.refRow-1:0,this.nbFilterableRows=this.getRowsNb())},t.prototype._buildInputFilter=function(t,e,i){var n=this,s=this.getFilterType(t),o=this.isExternalFlt?this.externalFltTgtIds[t]:null,l=s===S.INPUT?"text":"hidden",u=(0,a.createElm)(S.INPUT,["id",this.prfxFlt+t+"_"+this.id],["type",l],["ct",t]);"hidden"!==l&&this.watermark&&u.setAttribute("placeholder",this.isWatermarkArray?this.watermark[t]||"":this.watermark),u.className=e||this.fltCssClass,(0,r.addEvt)(u,"focus",function(t){return n.onInpFocus(t)}),o?(0,a.elm)(o).appendChild(u):i.appendChild(u),this.fltIds.push(u.id),(0,r.addEvt)(u,"keypress",function(t){return n.detectKey(t)}),(0,r.addEvt)(u,"keydown",function(){return n.onKeyDown()}),(0,r.addEvt)(u,"keyup",function(t){return n.onKeyUp(t)}),(0,r.addEvt)(u,"blur",function(){return n.onInpBlur()})},t.prototype._buildSubmitButton=function(t,e){var i=this,n=this.isExternalFlt?this.externalFltTgtIds[t]:null,s=(0,a.createElm)(S.INPUT,["id",this.prfxValButton+t+"_"+this.id],["type","button"],["value",this.btnText]);s.className=this.btnCssClass,n?(0,a.elm)(n).appendChild(s):e.appendChild(s),(0,r.addEvt)(s,"click",function(){return i.filter()})},t.prototype.feature=function(t){return this.Mod[t]},t.prototype.initExtensions=function(){var t=this.extensions;i.p=this.basePath,this.emitter.emit("before-loading-extensions",this);for(var e=0,n=t.length;e0&&void 0!==arguments[0]?arguments[0]:"default";return(0,a.elm)(this.prfxTf+t)},t.prototype.destroy=function(){var t=this;if(this.initialized){var e=this.Mod,i=this.emitter;this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.markActiveColumns&&(this.clearActiveColumns(),i.off(["before-filtering"],function(){return t.clearActiveColumns()}),i.off(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.hasExtensions&&this.destroyExtensions(),this.validateAllRows(),this.fltGrid&&!this.gridLayout&&this.tbl.deleteRow(this.filtersRowIndex),i.emit("destroy",this),Object.keys(e).forEach(function(t){var i=e[t];i&&(0,l.isFn)(i.destroy)&&i.destroy()}),this.hasVisibleRows&&i.off(["after-filtering"],function(){return t.enforceVisibility()}),this.linkedFilters&&i.off(["after-filtering"],function(){return t.linkFilters()}),this.emitter.off(["filter-focus"],function(e,i){return t.setActiveFilterId(i.id)}),(0,a.removeClass)(this.tbl,this.prfxTf),(0,a.removeClass)(this.tbl,this.prfxResponsive),this.nbHiddenRows=0,this.validRowsIndex=[],this.fltIds=[],this.initialized=!1}},t.prototype.setToolbar=function(){if(!this.infDiv){var t=(0,a.createElm)("div",["id",this.prfxInfDiv+this.id]);if(t.className=this.infDivCssClass,this.toolBarTgtId)(0,a.elm)(this.toolBarTgtId).appendChild(t);else if(this.gridLayout){var e=this.Mod.gridLayout;e.tblMainCont.appendChild(t),t.className=e.infDivCssClass}else{var i=(0,a.createElm)("caption");i.appendChild(t),this.tbl.insertBefore(i,this.tbl.firstChild)}this.infDiv=(0,a.elm)(this.prfxInfDiv+this.id);var n=(0,a.createElm)("div",["id",this.prfxLDiv+this.id]);n.className=this.lDivCssClass,t.appendChild(n),this.lDiv=(0,a.elm)(this.prfxLDiv+this.id);var s=(0,a.createElm)("div",["id",this.prfxRDiv+this.id]);s.className=this.rDivCssClass,t.appendChild(s),this.rDiv=(0,a.elm)(this.prfxRDiv+this.id);var r=(0,a.createElm)("div",["id",this.prfxMDiv+this.id]);r.className=this.mDivCssClass,t.appendChild(r),this.mDiv=(0,a.elm)(this.prfxMDiv+this.id),(0,l.isUndef)(this.help)&&(this.Mod.help.enabled=!0,this.emitter.emit("init-help",this))}},t.prototype.removeToolbar=function(){if(this.infDiv){(0,a.removeElm)(this.infDiv),this.infDiv=null;var t=this.tbl,e=(0,a.tag)(t,"caption");e.length>0&&[].forEach.call(e,function(e){return t.removeChild(e)})}},t.prototype.removeExternalFlts=function(){if(this.isExternalFlt)for(var t=this.externalFltTgtIds,e=t.length,i=0;i=R):z?(R=L(t.replace(m,""),j),n=D>R):U?(R=L(t.replace(g,""),j),n=D.toString()!==R.toString()):V?(R=L(t.replace(v,""),j),n=D.toString()===R.toString()):y.test(t)?n=(0,o.contains)(t.replace(y,""),e,!1,this.caseSensitive):A(t)?(R=L(t,j),n=D.toString()===R.toString()):n=F?(0,o.isEmpty)(e):P?!(0,o.isEmpty)(e):(0,o.contains)(t,e,this.isExactMatch(i),this.caseSensitive)}else{if(this.hasType(i,[S.FORMATTED_NUMBER])){var K=this.colTypes[i];K.hasOwnProperty("decimal")&&(f=K.decimal)}if(c=Number(e)||(0,u.parse)(e,f),r)n=c<=(0,u.parse)(t.replace(h,""),f);else if(l)n=c>=(0,u.parse)(t.replace(d,""),f);else if(s)n=c<(0,u.parse)(t.replace(p,""),f);else if(a)n=c>(0,u.parse)(t.replace(m,""),f);else if(E)n=!(0,o.contains)(t.replace(g,""),e,!1,this.caseSensitive);else if(k)n=(0,o.contains)(t.replace(y,""),e,!1,this.caseSensitive);else if(T)n=(0,o.contains)(t.replace(v,""),e,!0,this.caseSensitive);else if(N)n=0===e.indexOf(t.replace(b,""));else if(O){var Y=t.replace(x,"");n=e.lastIndexOf(Y,e.length-1)===e.length-1-(Y.length-1)&&e.lastIndexOf(Y,e.length-1)>-1}else if(F)n=(0,o.isEmpty)(e);else if(P)n=!(0,o.isEmpty)(e);else if(I)try{var G=t.replace(C,""),X=new RegExp(G);n=X.test(e)}catch(q){n=!1}else c&&this.hasType(i,[S.NUMBER,S.FORMATTED_NUMBER])&&!this.singleSearchFlt?(t=(0,u.parse)(t,f)||t,n=c===t||(0,o.contains)(t.toString(),c.toString(),this.isExactMatch(i),this.caseSensitive)):n=(0,o.contains)(t,e,this.isExactMatch(i),this.caseSensitive)}return n}if(this.fltGrid&&this.initialized){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var i=this.tbl.rows,n=this.getRowsNb(!0),s=0;this.validRowsIndex=[];for(var r=this.getFiltersValue(),c=void 0,f=this.decimalSeparator,h=new RegExp(this.leOperator),d=new RegExp(this.geOperator),p=new RegExp(this.lwOperator),m=new RegExp(this.grOperator),g=new RegExp(this.dfOperator),y=new RegExp((0,o.rgxEsc)(this.lkOperator)),v=new RegExp(this.eqOperator),b=new RegExp(this.stOperator),x=new RegExp(this.enOperator),_=this.emOperator,w=this.nmOperator,C=new RegExp((0,o.rgxEsc)(this.rgxOperator)),E=this.refRow;E1,A=I.toString().split(this.anOperator),L=A.length>1;if((0,l.isArray)(I)||M||L){var j=void 0,H=void 0,B=!1;H=(0,l.isArray)(I)?I:M?R:A;for(var z=0,W=H.length;z1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(this.fltGrid){var s=this.tbl.rows,r=this.getRowsNb(!0),a=[];e&&a.push(this.getHeadersText()[t]);for(var o=this.refRow;o0&&(l=n.indexOf(o)!==-1);var c=s[o].cells,f=c.length;if(f===this.nbCells&&!l)for(var h=0;h0&&void 0!==arguments[0]?arguments[0]:0,e=this.tbl.rows[t];return e.cells.length},t.prototype.getRowsNb=function(t){var e=(0,l.isUndef)(this.refRow)?0:this.refRow,i=this.tbl.rows.length;return t&&(e=0),parseInt(i-e,10)},t.prototype.getCellData=function(t){var e=t.cellIndex;return this.customCellData&&this.customCellDataCols.indexOf(e)!==-1?this.customCellData.call(null,this,t,e):(0,a.getText)(t)},t.prototype.getTableData=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.tbl.rows,n=this.getRowsNb(!0),s=[];if(t){var r=this.getHeadersText(e);s.push([this.getHeadersRowIndex(),r])}for(var a=this.refRow;a0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.validRowsIndex)return[];var i=this.tbl.rows,n=[];if(t){var s=this.getHeadersText(e);n.push([this.getHeadersRowIndex(),s])}for(var r=this.getValidRows(!0),a=0;a1&&void 0!==arguments[1]&&arguments[1];if((0,l.isUndef)(t))return[];var i=this.getFilteredData(),n=[];e&&n.push(this.getHeadersText()[t]);for(var s=0,r=i.length;s1&&void 0!==arguments[1]?arguments[1]:"";if(this.fltGrid){var i=this.getFilterElement(t),n=this.getFilterType(t);if(n!==S.MULTIPLE&&n!==S.CHECKLIST)this.loadFltOnDemand&&!this.initialized&&this.emitter.emit("build-select-filter",this,t,this.linkedFilters,this.isExternalFlt),i.value=e;else if(n===S.MULTIPLE){var s=(0,l.isArray)(e)?e:e.split(" "+this.orOperator+" ");this.loadFltOnDemand&&!this.initialized&&this.emitter.emit("build-select-filter",this,t,this.linkedFilters,this.isExternalFlt),this.emitter.emit("select-options",this,t,s)}else if(n===S.CHECKLIST){var r=[];this.loadFltOnDemand&&!this.initialized&&this.emitter.emit("build-checklist-filter",this,t,this.isExternalFlt),(0,l.isArray)(e)?r=e:(e=(0,o.matchCase)(e,this.caseSensitive),r=e.split(" "+this.orOperator+" ")),this.emitter.emit("select-checklist-options",this,t,r)}}},t.prototype.setColWidths=function(t){if(this.hasColWidths){t=t||this.tbl;for(var e=this.nbCells,i=this.colWidths,n=(0,a.tag)(t,"col"),s=n.length>0,r=s?null:N.createDocumentFragment(),o=0;o0&&void 0!==arguments[0]?arguments[0]:"",e=t.split("_")[0];return e=e.split(this.prfxFlt)[1],parseInt(e,10)},t.prototype.activateFilter=function(t){(0,l.isUndef)(t)||this.setActiveFilterId(this.getFilterId(t))},t.prototype.linkFilters=function(){if(this.linkedFilters&&this.activeFilterId){var t=this.getFiltersByType(S.SELECT,!0),e=this.getFiltersByType(S.MULTIPLE,!0),i=this.getFiltersByType(S.CHECKLIST,!0),n=t.concat(e);n=n.concat(i);for(var s=this.getColumnIndexFromFilterId(this.activeFilterId),r=0,o=n.length;r1&&void 0!==arguments[1]?arguments[1]:"script",i=!1,n="script"===e?"src":"href",s=(0,a.tag)(N,e),r=0,o=s.length;r3&&void 0!==arguments[3]?arguments[3]:"script";if(!this.isImported(e,s)){var r=this,o=!1,l=void 0,u=(0,a.tag)(N,"head")[0];l="link"===s.toLowerCase()?(0,a.createElm)("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):(0,a.createElm)("script",["id",t],["type","text/javascript"],["src",e]),l.onload=l.onreadystatechange=function(){o||n.readyState&&"loaded"!==n.readyState&&"complete"!==n.readyState||(o=!0,"function"==typeof i&&i.call(null,r))},l.onerror=function(){throw new Error("TableFilter could not load: "+e)},u.appendChild(l)}},t.prototype.isInitialized=function(){return this.initialized},t.prototype.getFiltersId=function(){return this.fltIds||[]},t.prototype.getValidRows=function(t){if(!t)return this.validRowsIndex;var e=this.getRowsNb(!0);this.validRowsIndex=[];for(var i=this.refRow;i1&&void 0!==arguments[1]?arguments[1]:[];if(!this.hasColTypes)return!1;var i=this.colTypes[t];return(0,l.isObj)(i)&&(i=i.type),e.indexOf(i)!==-1},t.prototype.getHeaderElement=function(t){for(var e=this.gridLayout?this.Mod.gridLayout.headTbl:this.tbl,i=(0,a.tag)(e,"thead"),n=this.headersRow,s=void 0,r=0;r",this.lwOperator=c.lower_operator||"<",this.leOperator=c.lower_equal_operator||"<=",this.geOperator=c.greater_equal_operator||">=",this.dfOperator=c.different_operator||"!",this.lkOperator=c.like_operator||"*",this.eqOperator=c.equal_operator||"=",this.stOperator=c.start_with_operator||"{",this.enOperator=c.end_with_operator||"}",this.separator=c.separator||",",this.rowsCounter=Boolean(c.rows_counter),this.statusBar=Boolean(c.status_bar),this.loader=Boolean(c.loader),this.displayBtn=Boolean(c.btn),this.btnText=c.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=c.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=Boolean(c.btn_reset),this.onBeforeReset=(0,l.isFn)(c.on_before_reset)?c.on_before_reset:null,this.onAfterReset=(0,l.isFn)(c.on_after_reset)?c.on_after_reset:null,this.paging=Boolean(c.paging),this.nbHiddenRows=0,this.autoFilter=Boolean(c.auto_filter),this.autoFilterDelay=isNaN(c.auto_filter_delay)?S.AUTO_FILTER_DELAY:c.auto_filter_delay,this.isUserTyping=null,this.autoFilterTimer=null,this.highlightKeywords=Boolean(c.highlight_keywords),this.noResults=(0,l.isObj)(c.no_results_message)||Boolean(c.no_results_message),this.state=(0,l.isObj)(c.state)||Boolean(c.state),this.locale=c.locale||"en",this.thousandsSeparator=c.thousands_separator||",",this.decimalSeparator=c.decimal_separator||".",this.hasColTypes=(0,l.isArray)(c.col_types),this.colTypes=this.hasColTypes?c.col_types:[],this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxResponsive="resp",this.extensions=c.extensions,this.hasExtensions=(0,l.isArray)(this.extensions),this.enableDefaultTheme=Boolean(c.enable_default_theme),this.hasThemes=this.enableDefaultTheme||(0,l.isArray)(c.themes),this.themes=c.themes||[],this.themesPath=c.themes_path||this.stylePath+"themes/",this.responsive=Boolean(c.responsive),this.Mod={},this.ExtRegistry={}}return t.prototype.init=function(){var t=this;if(!this.initialized){var e=this.Mod,i=this.singleSearchFlt?1:this.nbCells,n=void 0;if(this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this.loadThemes(),e.dateType||(e.dateType=new k.DateType(this),e.dateType.init()),e.help||(e.help=new w.Help(this)),this.help&&e.help.init(),this.state&&(e.state||(e.state=new T.State(this)),e.state.init()),this.gridLayout&&(e.gridLayout||(e.gridLayout=new h.GridLayout(this)),e.gridLayout.init()),this.loader&&(e.loader||(e.loader=new d.Loader(this)),e.loader.init()),this.highlightKeywords&&(e.highlightKeyword=new p.HighlightKeyword(this),e.highlightKeyword.init()),this.popupFilters&&(e.popupFilter||(e.popupFilter=new m.PopupFilter(this)),e.popupFilter.init()),this.fltGrid){var s=this._insertFiltersRow();this.nbFilterableRows=this.getRowsNb();for(var r=0;r0?e[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),t.className=this.fltsRowCssClass,this.isExternalFlt&&(t.style.display=S.NONE),this.emitter.emit("filters-row-inserted",this,t),t}},t.prototype._initNoFilters=function(){this.fltGrid||(this.refRow=this.refRow>0?this.refRow-1:0,this.nbFilterableRows=this.getRowsNb())},t.prototype._buildInputFilter=function(t,e,i){var n=this,s=this.getFilterType(t),o=this.isExternalFlt?this.externalFltTgtIds[t]:null,l=s===S.INPUT?"text":"hidden",u=(0,a.createElm)(S.INPUT,["id",this.prfxFlt+t+"_"+this.id],["type",l],["ct",t]);"hidden"!==l&&this.watermark&&u.setAttribute("placeholder",this.isWatermarkArray?this.watermark[t]||"":this.watermark),u.className=e||this.fltCssClass,(0,r.addEvt)(u,"focus",function(t){return n.onInpFocus(t)}),o?(0,a.elm)(o).appendChild(u):i.appendChild(u),this.fltIds.push(u.id),(0,r.addEvt)(u,"keypress",function(t){return n.detectKey(t)}),(0,r.addEvt)(u,"keydown",function(){return n.onKeyDown()}),(0,r.addEvt)(u,"keyup",function(t){return n.onKeyUp(t)}),(0,r.addEvt)(u,"blur",function(){return n.onInpBlur()})},t.prototype._buildSubmitButton=function(t,e){var i=this,n=this.isExternalFlt?this.externalFltTgtIds[t]:null,s=(0,a.createElm)(S.INPUT,["id",this.prfxValButton+t+"_"+this.id],["type","button"],["value",this.btnText]);s.className=this.btnCssClass,n?(0,a.elm)(n).appendChild(s):e.appendChild(s),(0,r.addEvt)(s,"click",function(){return i.filter()})},t.prototype.feature=function(t){return this.Mod[t]},t.prototype.initExtensions=function(){var t=this.extensions;i.p=this.basePath,this.emitter.emit("before-loading-extensions",this);for(var e=0,n=t.length;e0&&void 0!==arguments[0]?arguments[0]:"default";return(0,a.elm)(this.prfxTf+t)},t.prototype.destroy=function(){var t=this;if(this.initialized){var e=this.Mod,i=this.emitter;this.isExternalFlt&&!this.popupFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.markActiveColumns&&(this.clearActiveColumns(),i.off(["before-filtering"],function(){return t.clearActiveColumns()}),i.off(["cell-processed"],function(e,i){return t.markActiveColumn(i)})),this.hasExtensions&&this.destroyExtensions(),this.validateAllRows(),this.fltGrid&&!this.gridLayout&&this.tbl.deleteRow(this.filtersRowIndex),i.emit("destroy",this),Object.keys(e).forEach(function(t){var i=e[t];i&&(0,l.isFn)(i.destroy)&&i.destroy()}),this.hasVisibleRows&&i.off(["after-filtering"],function(){return t.enforceVisibility()}),this.linkedFilters&&i.off(["after-filtering"],function(){return t.linkFilters()}),this.emitter.off(["filter-focus"],function(e,i){return t.setActiveFilterId(i.id)}),(0,a.removeClass)(this.tbl,this.prfxTf),(0,a.removeClass)(this.tbl,this.prfxResponsive),this.nbHiddenRows=0,this.validRowsIndex=[],this.fltIds=[],this.initialized=!1}},t.prototype.setToolbar=function(){if(!this.infDiv){var t=(0,a.createElm)("div",["id",this.prfxInfDiv+this.id]);if(t.className=this.infDivCssClass,this.toolBarTgtId)(0,a.elm)(this.toolBarTgtId).appendChild(t);else if(this.gridLayout){var e=this.Mod.gridLayout;e.tblMainCont.appendChild(t),t.className=e.infDivCssClass}else{var i=(0,a.createElm)("caption");i.appendChild(t),this.tbl.insertBefore(i,this.tbl.firstChild)}this.infDiv=(0,a.elm)(this.prfxInfDiv+this.id);var n=(0,a.createElm)("div",["id",this.prfxLDiv+this.id]);n.className=this.lDivCssClass,t.appendChild(n),this.lDiv=(0,a.elm)(this.prfxLDiv+this.id);var s=(0,a.createElm)("div",["id",this.prfxRDiv+this.id]);s.className=this.rDivCssClass,t.appendChild(s),this.rDiv=(0,a.elm)(this.prfxRDiv+this.id);var r=(0,a.createElm)("div",["id",this.prfxMDiv+this.id]);r.className=this.mDivCssClass,t.appendChild(r),this.mDiv=(0,a.elm)(this.prfxMDiv+this.id),(0,l.isUndef)(this.help)&&(this.Mod.help.enabled=!0,this.emitter.emit("init-help",this))}},t.prototype.removeToolbar=function(){if(this.infDiv){(0,a.removeElm)(this.infDiv),this.infDiv=null;var t=this.tbl,e=(0,a.tag)(t,"caption");e.length>0&&[].forEach.call(e,function(e){return t.removeChild(e)})}},t.prototype.removeExternalFlts=function(){if(this.isExternalFlt)for(var t=this.externalFltTgtIds,e=t.length,i=0;i=R):z?(R=L(t.replace(m,""),j),n=D>R):U?(R=L(t.replace(g,""),j),n=D.toString()!==R.toString()):V?(R=L(t.replace(v,""),j),n=D.toString()===R.toString()):y.test(t)?n=(0,o.contains)(t.replace(y,""),e,!1,this.caseSensitive):A(t)?(R=L(t,j),n=D.toString()===R.toString()):n=F?(0,o.isEmpty)(e):P?!(0,o.isEmpty)(e):(0,o.contains)(t,e,this.isExactMatch(i),this.caseSensitive)}else{if(this.hasType(i,[S.FORMATTED_NUMBER])){var K=this.colTypes[i];K.hasOwnProperty("decimal")&&(f=K.decimal)}if(c=Number(e)||(0,u.parse)(e,f),r)n=c<=(0,u.parse)(t.replace(h,""),f);else if(l)n=c>=(0,u.parse)(t.replace(d,""),f);else if(s)n=c<(0,u.parse)(t.replace(p,""),f);else if(a)n=c>(0,u.parse)(t.replace(m,""),f);else if(E)n=!(0,o.contains)(t.replace(g,""),e,!1,this.caseSensitive);else if(k)n=(0,o.contains)(t.replace(y,""),e,!1,this.caseSensitive);else if(T)n=(0,o.contains)(t.replace(v,""),e,!0,this.caseSensitive);else if(N)n=0===e.indexOf(t.replace(b,""));else if(O){var Y=t.replace(x,"");n=e.lastIndexOf(Y,e.length-1)===e.length-1-(Y.length-1)&&e.lastIndexOf(Y,e.length-1)>-1}else if(F)n=(0,o.isEmpty)(e);else if(P)n=!(0,o.isEmpty)(e);else if(I)try{var G=t.replace(C,""),X=new RegExp(G);n=X.test(e)}catch(q){n=!1}else c&&this.hasType(i,[S.NUMBER,S.FORMATTED_NUMBER])&&!this.singleSearchFlt?(t=(0,u.parse)(t,f)||t,n=c===t||(0,o.contains)(t.toString(),c.toString(),this.isExactMatch(i),this.caseSensitive)):n=(0,o.contains)(t,e,this.isExactMatch(i),this.caseSensitive)}return n}if(this.fltGrid&&this.initialized){this.onBeforeFilter&&this.onBeforeFilter.call(null,this),this.emitter.emit("before-filtering",this);var i=this.tbl.rows,n=this.getRowsNb(!0),s=0;this.validRowsIndex=[];for(var r=this.getFiltersValue(),c=void 0,f=this.decimalSeparator,h=new RegExp(this.leOperator),d=new RegExp(this.geOperator),p=new RegExp(this.lwOperator),m=new RegExp(this.grOperator),g=new RegExp(this.dfOperator),y=new RegExp((0,o.rgxEsc)(this.lkOperator)),v=new RegExp(this.eqOperator),b=new RegExp(this.stOperator),x=new RegExp(this.enOperator),_=this.emOperator,w=this.nmOperator,C=new RegExp((0,o.rgxEsc)(this.rgxOperator)),E=this.refRow;E1,A=I.toString().split(this.anOperator),L=A.length>1;if((0,l.isArray)(I)||M||L){var j=void 0,H=void 0,B=!1;H=(0,l.isArray)(I)?I:M?R:A;for(var z=0,W=H.length;z1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(this.fltGrid){var s=this.tbl.rows,r=this.getRowsNb(!0),a=[];e&&a.push(this.getHeadersText()[t]);for(var o=this.refRow;o0&&(l=n.indexOf(o)!==-1);var c=s[o].cells,f=c.length;if(f===this.nbCells&&!l)for(var h=0;h0&&void 0!==arguments[0]?arguments[0]:0,e=this.tbl.rows[t];return e.cells.length},t.prototype.getRowsNb=function(t){var e=(0,l.isUndef)(this.refRow)?0:this.refRow,i=this.tbl.rows.length;return t&&(e=0),parseInt(i-e,10)},t.prototype.getCellData=function(t){var e=t.cellIndex;return this.customCellData&&this.customCellDataCols.indexOf(e)!==-1?this.customCellData.call(null,this,t,e):(0,a.getText)(t)},t.prototype.getTableData=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.tbl.rows,n=this.getRowsNb(!0),s=[];if(t){var r=this.getHeadersText(e);s.push([this.getHeadersRowIndex(),r])}for(var a=this.refRow;a0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.validRowsIndex)return[];var i=this.tbl.rows,n=[];if(t){var s=this.getHeadersText(e);n.push([this.getHeadersRowIndex(),s])}for(var r=this.getValidRows(!0),a=0;a1&&void 0!==arguments[1]&&arguments[1];if((0,l.isUndef)(t))return[];var i=this.getFilteredData(),n=[];e&&n.push(this.getHeadersText()[t]);for(var s=0,r=i.length;s1&&void 0!==arguments[1]?arguments[1]:"";if(this.fltGrid){var i=this.getFilterElement(t),n=this.getFilterType(t);if(n!==S.MULTIPLE&&n!==S.CHECKLIST)this.loadFltOnDemand&&!this.initialized&&this.emitter.emit("build-select-filter",this,t,this.linkedFilters,this.isExternalFlt),i.value=e;else if(n===S.MULTIPLE){var s=(0,l.isArray)(e)?e:e.split(" "+this.orOperator+" ");this.loadFltOnDemand&&!this.initialized&&this.emitter.emit("build-select-filter",this,t,this.linkedFilters,this.isExternalFlt),this.emitter.emit("select-options",this,t,s)}else if(n===S.CHECKLIST){var r=[];this.loadFltOnDemand&&!this.initialized&&this.emitter.emit("build-checklist-filter",this,t,this.isExternalFlt),(0,l.isArray)(e)?r=e:(e=(0,o.matchCase)(e,this.caseSensitive),r=e.split(" "+this.orOperator+" ")),this.emitter.emit("select-checklist-options",this,t,r)}}},t.prototype.setColWidths=function(t){if(this.hasColWidths){t=t||this.tbl;for(var e=this.nbCells,i=this.colWidths,n=(0,a.tag)(t,"col"),s=n.length>0,r=s?null:N.createDocumentFragment(),o=0;o0&&void 0!==arguments[0]?arguments[0]:"",e=t.split("_")[0];return e=e.split(this.prfxFlt)[1],parseInt(e,10)},t.prototype.activateFilter=function(t){(0,l.isUndef)(t)||this.setActiveFilterId(this.getFilterId(t))},t.prototype.linkFilters=function(){if(this.linkedFilters&&this.activeFilterId){var t=this.getFiltersByType(S.SELECT,!0),e=this.getFiltersByType(S.MULTIPLE,!0),i=this.getFiltersByType(S.CHECKLIST,!0),n=t.concat(e);n=n.concat(i);for(var s=this.getColumnIndexFromFilterId(this.activeFilterId),r=0,o=n.length;r1&&void 0!==arguments[1]?arguments[1]:"script",i=!1,n="script"===e?"src":"href",s=(0,a.tag)(N,e),r=0,o=s.length;r3&&void 0!==arguments[3]?arguments[3]:"script";if(!this.isImported(e,s)){var r=this,o=!1,l=void 0,u=(0,a.tag)(N,"head")[0];l="link"===s.toLowerCase()?(0,a.createElm)("link",["id",t],["type","text/css"],["rel","stylesheet"],["href",e]):(0,a.createElm)("script",["id",t],["type","text/javascript"],["src",e]),l.onload=l.onreadystatechange=function(){o||n.readyState&&"loaded"!==n.readyState&&"complete"!==n.readyState||(o=!0,"function"==typeof i&&i.call(null,r))},l.onerror=function(){throw new Error("TableFilter could not load: "+e)},u.appendChild(l)}},t.prototype.isInitialized=function(){return this.initialized},t.prototype.getFiltersId=function(){return this.fltIds||[]},t.prototype.getValidRows=function(t){if(!t)return this.validRowsIndex;var e=this.getRowsNb(!0);this.validRowsIndex=[];for(var i=this.refRow;i1&&void 0!==arguments[1]?arguments[1]:[];if(!this.hasColTypes)return!1;var i=this.colTypes[t];return(0,l.isObj)(i)&&(i=i.type),e.indexOf(i)!==-1},t.prototype.getHeaderElement=function(t){for(var e=this.gridLayout?this.Mod.gridLayout.headTbl:this.tbl,i=(0,a.tag)(e,"thead"),n=this.headersRow,s=void 0,r=0;r0&&void 0!==arguments[0]&&arguments[0],e=[],i=0;i0&&void 0!==arguments[0]&&arguments[0];return this.getValidRows(t).length},t.prototype.config=function(){return this.cfg},t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.keyCode=e.targetEvt=e.cancelEvt=e.stopEvt=e.removeEvt=e.addEvt=void 0;var n=i(2);e.addEvt=function(t,e,i,n){t.addEventListener?t.addEventListener(e,i,n):t.attachEvent?t.attachEvent("on"+e,i):t["on"+e]=i},e.removeEvt=function(t,e,i,n){t.detachEvent?t.detachEvent("on"+e,i):t.removeEventListener?t.removeEventListener(e,i,n):t["on"+e]=null},e.stopEvt=function(t){t||(t=n.root.event),t.stopPropagation?t.stopPropagation():t.cancelBubble=!0},e.cancelEvt=function(t){t||(t=n.root.event),t.preventDefault?t.preventDefault():t.returnValue=!1},e.targetEvt=function(t){return t||(t=n.root.event),t.target||t.srcElement},e.keyCode=function(t){return t.charCode?t.charCode:t.keyCode?t.keyCode:t.which?t.which:0}},function(t,e){(function(t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};e.root="object"===("undefined"==typeof self?"undefined":i(self))&&self.self===self&&self||"object"===("undefined"==typeof t?"undefined":i(t))&&t.global===t&&t||void 0}).call(e,function(){return this}())},function(t,e,i){"use strict";function n(){return o.documentElement.classList}Object.defineProperty(e,"__esModule",{value:!0}),e.tag=e.elm=e.createCheckItem=e.createOpt=e.removeClass=e.addClass=e.hasClass=e.createText=e.removeElm=e.createElm=e.getFirstTextNode=e.getText=void 0;var s=i(2),r=i(4),a=i(5),o=s.root.document,l=(e.getText=function(t){return(0,r.isUndef)(t.textContent)?(0,a.trim)(t.innerText):(0,a.trim)(t.textContent)},e.getFirstTextNode=function(t){for(var e=0;e1&&void 0!==arguments[1]&&arguments[1];return e?t:t.toLowerCase()},e.contains=function(t,e){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=void 0,a=s?"g":"gi";return r=i?new RegExp("(^\\s*)"+n(t)+"(\\s*$)",a):new RegExp(n(t),a),r.test(e)}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.parse=void 0;var n=i(4);e.parse=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:".";if((0,n.isNumber)(t))return t;var i=new RegExp("[^0-9-"+e+"]",["g"]),s=parseFloat((""+t).replace(/\((.*)\)/,"-$1").replace(i,"").replace(e,"."));return isNaN(s)?0:s}},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});e.Emitter=function(){function t(){i(this,t),this.events={}}return t.prototype.on=function(t,e){var i=this;t.forEach(function(t){i.events[t]=i.events[t]||[],i.events[t].push(e)})},t.prototype.off=function(t,e){var i=this;t.forEach(function(t){t in i.events&&i.events[t].splice(i.events[t].indexOf(e),1)})},t.prototype.emit=function(t){if(t in this.events)for(var e=0;e0,r.tblMainCont=null,r.tblCont=null,r.headTblCont=null,r.headTbl=null,i.fltGrid=r.enableFilters,r}return r(e,t),e.prototype.init=function(){var t=this,e=this.tf,i=e.tbl;if(!this.initialized){this.setOverrides(),this.setDefaultColWidths();var n=this.initialTableWidth();this.tblMainCont=this.createContainer(this.prfxMainTblCont+e.id,"div",this.mainContCssClass),this.width&&(this.tblMainCont.style.width=this.width),i.parentNode.insertBefore(this.tblMainCont,i),this.tblCont=this.createContainer(this.prfxTblCont+e.id,"div",this.contCssClass),this.setConfigWidth(this.tblCont),this.height&&(this.tblCont.style.height=this.height),i.parentNode.insertBefore(this.tblCont,i);var s=(0,o.removeElm)(i);this.tblCont.appendChild(s),""===i.style.width&&(i.style.width=((0,u.contains)("%",n)?i.clientWidth:n)+"px");var r=(0,o.removeElm)(this.tblCont);this.tblMainCont.appendChild(r),this.headTblCont=this.createContainer(this.prfxHeadTblCont+e.id,"div",this.headContCssClass),this.setConfigWidth(this.headTblCont),this.headTbl=(0,o.createElm)("table",["id",this.prfxHeadTbl+e.id]);var a=(0,o.createElm)("tHead"),f=i.rows[this.headRowIndex],h=this.getSortTriggerIds(f),d=this.createFiltersRow();this.setHeadersRow(a),this.headTbl.appendChild(a),0===e.filtersRowIndex?a.insertBefore(d,f):a.appendChild(d),this.headTblCont.appendChild(this.headTbl),this.tblCont.parentNode.insertBefore(this.headTblCont,this.tblCont);var p=(0,o.tag)(i,"thead");p.length>0&&i.removeChild(p[0]),this.headTbl.style.tableLayout="fixed",i.style.tableLayout="fixed",this.headTbl.cellPadding=i.cellPadding,this.headTbl.cellSpacing=i.cellSpacing,e.setColWidths(this.headTbl),i.style.width="",this.headTbl.style.width=i.clientWidth+"px",(0,l.addEvt)(this.tblCont,"scroll",function(e){var i=(0,l.targetEvt)(e),n=i.scrollLeft;t.headTblCont.scrollLeft=n});var m=e.extension("sort");m&&(m.asyncSort=!0,m.triggerIds=h),this.setColumnElements(),e.popupFilters&&(d.style.display=c.NONE),i.clientWidth!==this.headTbl.clientWidth&&(i.style.width=this.headTbl.clientWidth+"px"),this.initialized=!0}},e.prototype.setOverrides=function(){var t=this.tf;t.refRow=0,t.headersRow=0,t.filtersRowIndex=1,t.isExternalFlt=!0},e.prototype.setDefaultColWidths=function(){var t=this.tf;if(!t.hasColWidths){for(var e=0,i=t.getCellsNb();e0;for(var i=t.nbCells-1;i>=0;i--){var n=void 0,s=t.id+"_col_"+i;this.tblHasColTag?(n=e[i],n.setAttribute("id",s)):(n=(0,o.createElm)("col",["id",s]),t.tbl.insertBefore(n,t.tbl.firstChild)),n.style.width=t.colWidths[i],this.colElms[i]=n}this.tblHasColTag=!0},e.prototype.setHeadersRow=function(t){if(this.noHeaders)t.appendChild((0,o.createElm)("tr"));else for(var e=0;e',r.containerCssClass=a.popup_div_css_class||"popUpFilter",r.onBeforeOpen=(0,o.isFn)(a.on_before_popup_filter_open)?a.on_before_popup_filter_open:null,r.onAfterOpen=(0,o.isFn)(a.on_after_popup_filter_open)?a.on_after_popup_filter_open:null,r.onBeforeClose=(0,o.isFn)(a.on_before_popup_filter_close)?a.on_before_popup_filter_close:null,r.onAfterClose=(0,o.isFn)(a.on_after_popup_filter_close)?a.on_after_popup_filter_close:null,r.fltSpans=[],r.fltIcons=[],r.filtersCache=null,r.fltElms=r.filtersCache||[],r.adjustToContainer=!0,r.prfxSpan="popUpSpan_",r.prfxDiv="popUpDiv_",r}return r(e,t),e.prototype.onClick=function(t){var e=(0,u.targetEvt)(t).parentNode,i=parseInt(e.getAttribute("ci"),10);if(this.closeAll(i),this.toggle(i),this.adjustToContainer){var n=this.fltElms[i],s=this.tf.getHeaderElement(i),r=.95*s.clientWidth;n.style.width=parseInt(r,10)+"px"}(0,u.cancelEvt)(t),(0,u.stopEvt)(t)},e.prototype.init=function(){var t=this;if(!this.initialized){var e=this.tf;e.headersRow<=1&&isNaN(e.config().headers_row_index)&&(e.headersRow=0),e.gridLayout&&(e.headersRow--,this.buildIcons()),this.emitter.on(["before-filtering"],function(){return t.setIconsState()}),this.emitter.on(["after-filtering"],function(){return t.closeAll()}),this.emitter.on(["cell-processed"],function(e,i){return t.changeState(i,!0)}),this.emitter.on(["filters-row-inserted"],function(){return t.buildIcons()}),this.emitter.on(["before-filter-init"],function(e,i){return t.build(i)}),this.initialized=!0}},e.prototype.reset=function(){this.enable(),this.init(),this.buildAll()},e.prototype.buildIcons=function(){var t=this,e=this.tf;e.headersRow++;for(var i=0;i1&&void 0!==arguments[1]&&arguments[1],i=this.tf;t=parseInt(t,10),this.emitter.emit("before-populating-filter",i,t),this.opts=[],this.optsTxt=[];var n=i.fltIds[t],s=(0,o.elm)(n),r=i.tbl.rows,a=i.getRowsNb(!0);this.isCustom=i.isCustomOptions(t);var f=void 0,h=i.getActiveFilterId();e&&h&&(f=i.getColumnIndexFromFilterId(h));var p=null,m=null;e&&i.disableExcludedOptions&&(p=[],m=[]);for(var g=i.refRow;g1&&void 0!==arguments[1]?arguments[1]:[],i=this.tf;if(i.getFilterType(t)===h.MULTIPLE&&0!==e.length){var n=i.getFilterElement(t);[].forEach.call(n.options,function(t){""!==e[0]&&""!==t.value||(t.selected=!1),""!==t.value&&(0,l.has)(e,t.value,!0)&&(t.selected=!0)})}},e.prototype.getValues=function(t){var e=this.tf,i=e.getFilterElement(t),n=[];return i.selectedOptions?[].forEach.call(i.selectedOptions,function(t){return n.push(t.value)}):[].forEach.call(i.options,function(t){t.selected&&n.push(t.value)}),n},e.prototype.destroy=function(){var t=this;this.emitter.off(["build-select-filter"],function(e,i,n){return t.build(e,i,n)}),this.emitter.off(["select-options"],function(e,i,n){return t.selectOptions(i,n)})},e}(a.Feature)},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.has=void 0;var n=i(5);e.has=function(t,e,i){for(var s=Boolean(i),r=0,a=t.length;rn?1:0},e.numSortAsc=function(t,e){return t-e},e.numSortDesc=function(t,e){return e-t}},function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.CheckList=void 0;var a=i(9),o=i(3),l=i(15),u=i(5),c=i(16),f=i(1),h=i(4),d=i(10),p="Filter options for column {0} cannot be sorted in {1} manner.";e.CheckList=function(t){function e(i){n(this,e);var r=s(this,t.call(this,i,"checkList")),a=r.config;return r.containers=[],r.containerCssClass=a.div_checklist_css_class||"div_checklist",r.filterCssClass=a.checklist_css_class||"flt_checklist",r.itemCssClass=a.checklist_item_css_class||"flt_checklist_item",r.selectedItemCssClass=a.checklist_selected_item_css_class||"flt_checklist_slc_item",r.activateText=a.activate_checklist_text||"Click to load filter data",r.disabledItemCssClass=a.checklist_item_disabled_css_class||"flt_checklist_item_disabled",r.enableResetOption=a.enable_checklist_reset_filter!==!1,r.prfx="chkdiv_",r.isCustom=!1,r.opts=[],r.optsTxt=[],r.excludedOpts=[],r}return r(e,t),e.prototype.optionClick=function(t){var e=(0,f.targetEvt)(t),i=this.tf;this.emitter.emit("filter-focus",i,e),this.setCheckListValues(e),i.filter()},e.prototype.onCheckListClick=function(t){var e=this,i=(0,f.targetEvt)(t);if(this.tf.loadFltOnDemand&&"0"===i.getAttribute("filled")){var n=i.getAttribute("ct"),s=this.containers[n];this.build(n),(0,f.removeEvt)(s,"click",function(t){return e.onCheckListClick(t)})}},e.prototype.init=function(t,e,i){var n=this,s=this.tf,r=e?s.externalFltTgtIds[t]:null,a=(0,o.createElm)("div",["id",this.prfx+t+"_"+s.id],["ct",t],["filled","0"]);a.className=this.containerCssClass,r?(0,o.elm)(r).appendChild(a):i.appendChild(a),this.containers[t]=a,s.fltIds.push(s.prfxFlt+t+"_"+s.id),s.loadFltOnDemand?((0,f.addEvt)(a,"click",function(t){return n.onCheckListClick(t)}),a.appendChild((0,o.createText)(this.activateText))):this.build(t),this.emitter.on(["build-checklist-filter"],function(t,e){return n.build(e)}),this.emitter.on(["select-checklist-options"],function(t,e,i){return n.selectOptions(e,i)}),this.initialized=!0},e.prototype.build=function(t){var e=this.tf;t=parseInt(t,10),this.emitter.emit("before-populating-filter",e,t),this.opts=[],this.optsTxt=[];var i=this.containers[t],n=(0,o.createElm)("ul",["id",e.fltIds[t]],["colIndex",t]);n.className=this.filterCssClass; var s=e.tbl.rows,r=e.getRowsNb(!0),a=e.caseSensitive;this.isCustom=e.isCustomOptions(t);var f=void 0,h=e.getActiveFilterId();e.linkedFilters&&h&&(f=e.getColumnIndexFromFilterId(h));var d=[];e.linkedFilters&&e.disableExcludedOptions&&(this.excludedOpts=[]),i.innerHTML="";for(var m=e.refRow;m1&&void 0!==arguments[1]?arguments[1]:[],i=this.tf,n=i.getFilterElement(t);if(i.getFilterType(t)===d.CHECKLIST&&n){var s=(0,o.tag)(n,"li").length;n.setAttribute("value",""),n.setAttribute("indexes","");for(var r=0;r0?1:0),r=s+n.pagingLength-1<=e.getValidRowsNb()?s+n.pagingLength-1:e.getValidRowsNb();i=s+this.fromToTextSeparator+r+this.overText+e.getValidRowsNb()}}else i=t&&""!==t?t:e.getFilterableRowsNb()-e.nbHiddenRows;this.label.innerHTML=i,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.label,i)}},e.prototype.destroy=function(){var t=this;this.initialized&&(!this.targetId&&this.container?(0,o.removeElm)(this.container):(0,o.elm)(this.targetId).innerHTML="",this.label=null,this.container=null,this.emitter.off(["after-filtering","grouped-by-page"],function(){return t.refresh(tf.getValidRowsNb())}),this.emitter.off(["rows-changed"],function(){return t.refresh()}),this.initialized=!1)},e}(a.Feature)},function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.StatusBar=void 0;var a=i(9),o=i(2),l=i(3),u=i(4);e.StatusBar=function(t){function e(i){n(this,e);var r=s(this,t.call(this,i,"statusBar")),a=r.config;return r.targetId=a.status_bar_target_id||null,r.container=null,r.msgContainer=null,r.labelContainer=null,r.text=a.status_bar_text||"",r.cssClass=a.status_bar_css_class||"status",r.delay=250,r.onBeforeShowMsg=(0,u.isFn)(a.on_before_show_msg)?a.on_before_show_msg:null,r.onAfterShowMsg=(0,u.isFn)(a.on_after_show_msg)?a.on_after_show_msg:null,r.msgFilter=a.msg_filter||"Filtering data...",r.msgPopulate=a.msg_populate||"Populating filter...",r.msgPopulateCheckList=a.msg_populate_checklist||"Populating list...",r.msgChangePage=a.msg_change_page||"Collecting paging data...",r.msgClear=a.msg_clear||"Clearing filters...",r.msgChangeResults=a.msg_change_results||"Changing results per page...",r.msgResetPage=a.msg_reset_page||"Re-setting page...",r.msgResetPageLength=a.msg_reset_page_length||"Re-setting page length...",r.msgSort=a.msg_sort||"Sorting data...",r.msgLoadExtensions=a.msg_load_extensions||"Loading extensions...",r.msgLoadThemes=a.msg_load_themes||"Loading theme(s)...",r.prfxCont="status_",r.prfxLabel="statusSpan_",r.prfxText="statusText_",r}return r(e,t),e.prototype.init=function(){var t=this;if(!this.initialized){var e=this.tf,i=this.emitter,n=(0,l.createElm)("div",["id",this.prfxCont+e.id]);n.className=this.cssClass;var s=(0,l.createElm)("span",["id",this.prfxLabel+e.id]),r=(0,l.createElm)("span",["id",this.prfxText+e.id]);r.appendChild((0,l.createText)(this.text)),this.targetId||e.setToolbar();var a=this.targetId?(0,l.elm)(this.targetId):e.lDiv;this.targetId?(a.appendChild(r),a.appendChild(s)):(n.appendChild(r),n.appendChild(s),a.appendChild(n)),this.container=n,this.msgContainer=s,this.labelContainer=r,i.on(["before-filtering"],function(){return t.message(t.msgFilter)}),i.on(["before-populating-filter"],function(){return t.message(t.msgPopulate)}),i.on(["before-page-change"],function(){return t.message(t.msgChangePage)}),i.on(["before-clearing-filters"],function(){return t.message(t.msgClear)}),i.on(["before-page-length-change"],function(){return t.message(t.msgChangeResults)}),i.on(["before-reset-page"],function(){return t.message(t.msgResetPage)}),i.on(["before-reset-page-length"],function(){return t.message(t.msgResetPageLength)}),i.on(["before-loading-extensions"],function(){return t.message(t.msgLoadExtensions)}),i.on(["before-loading-themes"],function(){return t.message(t.msgLoadThemes)}),i.on(["after-filtering","after-populating-filter","after-page-change","after-clearing-filters","after-page-length-change","after-reset-page","after-reset-page-length","after-loading-extensions","after-loading-themes"],function(){return t.message("")}),this.initialized=!0}},e.prototype.message=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";if(this.isEnabled()){this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this.tf,e);var i=""===e?this.delay:1;o.root.setTimeout(function(){t.initialized&&(t.msgContainer.innerHTML=e,t.onAfterShowMsg&&t.onAfterShowMsg.call(null,t.tf,e))},i)}},e.prototype.destroy=function(){var t=this;if(this.initialized){var e=this.emitter;this.container.innerHTML="",this.targetId||(0,l.removeElm)(this.container),this.labelContainer=null,this.msgContainer=null,this.container=null,e.off(["before-filtering"],function(){return t.message(t.msgFilter)}),e.off(["before-populating-filter"],function(){return t.message(t.msgPopulate)}),e.off(["before-page-change"],function(){return t.message(t.msgChangePage)}),e.off(["before-clearing-filters"],function(){return t.message(t.msgClear)}),e.off(["before-page-length-change"],function(){return t.message(t.msgChangeResults)}),e.off(["before-reset-page"],function(){return t.message(t.msgResetPage)}),e.off(["before-reset-page-length"],function(){return t.message(t.msgResetPageLength)}),e.off(["before-loading-extensions"],function(){return t.message(t.msgLoadExtensions)}),e.off(["before-loading-themes"],function(){return t.message(t.msgLoadThemes)}),e.off(["after-filtering","after-populating-filter","after-page-change","after-clearing-filters","after-page-length-change","after-reset-page","after-reset-page-length","after-loading-extensions","after-loading-themes"],function(){return t.message("")}),this.initialized=!1}},e}(a.Feature)},function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.Paging=void 0;var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=i(9),l=i(3),u=i(4),c=i(1),f=i(10);e.Paging=function(t){function e(i){n(this,e);var r=s(this,t.call(this,i,"paging")),a=r.config;r.btnPageCssClass=a.paging_btn_css_class||"pgInp",r.pagingSlc=null,r.resultsPerPageSlc=null,r.pagingTgtId=a.paging_target_id||null,r.pagingLength=isNaN(a.paging_length)?10:a.paging_length,r.resultsPerPageTgtId=a.results_per_page_target_id||null,r.pgSlcCssClass=a.paging_slc_css_class||"pgSlc",r.pgInpCssClass=a.paging_inp_css_class||"pgNbInp",r.resultsPerPage=a.results_per_page||null,r.hasResultsPerPage=(0,u.isArray)(r.resultsPerPage),r.resultsSlcCssClass=a.results_slc_css_class||"rspg",r.resultsSpanCssClass=a.results_span_css_class||"rspgSpan",r.startPagingRow=0,r.nbPages=0,r.currentPageNb=1,r.btnNextPageText=a.btn_next_page_text||">",r.btnPrevPageText=a.btn_prev_page_text||"<",r.btnLastPageText=a.btn_last_page_text||">|",r.btnFirstPageText=a.btn_first_page_text||"|<",r.btnNextPageHtml=a.btn_next_page_html||(i.enableIcons?'':null),r.btnPrevPageHtml=a.btn_prev_page_html||(i.enableIcons?'':null),r.btnFirstPageHtml=a.btn_first_page_html||(i.enableIcons?'':null),r.btnLastPageHtml=a.btn_last_page_html||(i.enableIcons?'':null),r.pageText=a.page_text||" Page ",r.ofText=a.of_text||" of ",r.nbPgSpanCssClass=a.nb_pages_css_class||"nbpg",r.hasPagingBtns=a.paging_btns!==!1,r.pageSelectorType=a.page_selector_type||f.SELECT,r.onBeforeChangePage=(0,u.isFn)(a.on_before_change_page)?a.on_before_change_page:null,r.onAfterChangePage=(0,u.isFn)(a.on_after_change_page)?a.on_after_change_page:null,r.prfxSlcPages="slcPages_",r.prfxSlcResults="slcResults_",r.prfxSlcResultsTxt="slcResultsTxt_",r.prfxBtnNextSpan="btnNextSpan_",r.prfxBtnPrevSpan="btnPrevSpan_",r.prfxBtnLastSpan="btnLastSpan_",r.prfxBtnFirstSpan="btnFirstSpan_",r.prfxBtnNext="btnNext_",r.prfxBtnPrev="btnPrev_",r.prfxBtnLast="btnLast_",r.prfxBtnFirst="btnFirst_",r.prfxPgSpan="pgspan_",r.prfxPgBeforeSpan="pgbeforespan_",r.prfxPgAfterSpan="pgafterspan_";var o=i.refRow,l=i.getRowsNb(!0);r.nbPages=Math.ceil((l-o)/r.pagingLength);var h=r;return r.evt={slcIndex:function(){return h.pageSelectorType===f.SELECT?h.pagingSlc.options.selectedIndex:parseInt(h.pagingSlc.value,10)-1},nbOpts:function(){return h.pageSelectorType===f.SELECT?parseInt(h.pagingSlc.options.length,10)-1:h.nbPages-1},next:function(){var t=h.evt.slcIndex()0?h.evt.slcIndex()-1:h.evt.nbOpts();h.changePage(t)},last:function(){h.changePage(h.evt.nbOpts())},first:function(){h.changePage(0)},_detectKey:function(t){var e=(0,c.keyCode)(t);e===f.ENTER_KEY&&(i.sorted?(i.filter(),h.changePage(h.evt.slcIndex())):h.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},r}return r(e,t),e.prototype.init=function(){var t,e=this,i=this.tf,n=this.evt;if(!this.initialized){this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),n.slcPagesChange=function(t){var i=t.target;e.changePage(i.selectedIndex)},this.pageSelectorType===f.SELECT&&(t=(0,l.createElm)(f.SELECT,["id",this.prfxSlcPages+i.id]),t.className=this.pgSlcCssClass,(0,c.addEvt)(t,"change",n.slcPagesChange)),this.pageSelectorType===f.INPUT&&(t=(0,l.createElm)(f.INPUT,["id",this.prfxSlcPages+i.id],["value",this.currentPageNb]),t.className=this.pgInpCssClass,(0,c.addEvt)(t,"keypress",n._detectKey));var s=(0,l.createElm)("span",["id",this.prfxBtnNextSpan+i.id]),r=(0,l.createElm)("span",["id",this.prfxBtnPrevSpan+i.id]),a=(0,l.createElm)("span",["id",this.prfxBtnLastSpan+i.id]),o=(0,l.createElm)("span",["id",this.prfxBtnFirstSpan+i.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)s.innerHTML=this.btnNextPageHtml,(0,c.addEvt)(s,"click",n.next);else{var u=(0,l.createElm)(f.INPUT,["id",this.prfxBtnNext+i.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);u.className=this.btnPageCssClass,(0,c.addEvt)(u,"click",n.next),s.appendChild(u)}if(this.btnPrevPageHtml)r.innerHTML=this.btnPrevPageHtml,(0,c.addEvt)(r,"click",n.prev);else{var h=(0,l.createElm)(f.INPUT,["id",this.prfxBtnPrev+i.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);h.className=this.btnPageCssClass,(0,c.addEvt)(h,"click",n.prev),r.appendChild(h)}if(this.btnLastPageHtml)a.innerHTML=this.btnLastPageHtml,(0,c.addEvt)(a,"click",n.last);else{var d=(0,l.createElm)(f.INPUT,["id",this.prfxBtnLast+i.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);d.className=this.btnPageCssClass,(0,c.addEvt)(d,"click",n.last),a.appendChild(d)}if(this.btnFirstPageHtml)o.innerHTML=this.btnFirstPageHtml,(0,c.addEvt)(o,"click",n.first);else{var p=(0,l.createElm)(f.INPUT,["id",this.prfxBtnFirst+i.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);p.className=this.btnPageCssClass,(0,c.addEvt)(p,"click",n.first),o.appendChild(p)}}this.pagingTgtId||i.setToolbar();var m=this.pagingTgtId?(0,l.elm)(this.pagingTgtId):i.mDiv;m.appendChild(o),m.appendChild(r);var g=(0,l.createElm)("span",["id",this.prfxPgBeforeSpan+i.id]);g.appendChild((0,l.createText)(this.pageText)),g.className=this.nbPgSpanCssClass,m.appendChild(g),m.appendChild(t);var y=(0,l.createElm)("span",["id",this.prfxPgAfterSpan+i.id]);y.appendChild((0,l.createText)(this.ofText)),y.className=this.nbPgSpanCssClass,m.appendChild(y);var v=(0,l.createElm)("span",["id",this.prfxPgSpan+i.id]);v.className=this.nbPgSpanCssClass,v.appendChild((0,l.createText)(" "+this.nbPages+" ")),m.appendChild(v),m.appendChild(s),m.appendChild(a),this.pagingSlc=(0,l.elm)(this.prfxSlcPages+i.id),this.setPagingInfo(),i.fltGrid||(i.validateAllRows(),this.setPagingInfo(i.validRowsIndex)),this.emitter.on(["after-filtering"],function(){return e.resetPagingInfo()}),this.emitter.on(["change-page"],function(t,i){return e.setPage(i)}),this.emitter.on(["change-page-results"],function(t,i){return e.changeResultsPerPage(i)}),this.initialized=!0}},e.prototype.reset=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.tf;this.isEnabled()||(this.enable(),this.init(),t&&e.filter())},e.prototype.resetPagingInfo=function(){this.startPagingRow=0,this.currentPageNb=1,this.setPagingInfo(this.tf.validRowsIndex)},e.prototype.setPagingInfo=function(t){var e=this.tf,i=this.pagingTgtId?(0,l.elm)(this.pagingTgtId):e.mDiv,n=(0,l.elm)(this.prfxPgSpan+e.id);if(e.validRowsIndex=t||e.getValidRows(!0),this.nbPages=Math.ceil(e.validRowsIndex.length/this.pagingLength),n.innerHTML=this.nbPages,this.pageSelectorType===f.SELECT&&(this.pagingSlc.innerHTML=""),this.nbPages>0)if(i.style.visibility="visible",this.pageSelectorType===f.SELECT)for(var s=0;s=n&&r=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t+1),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===f.SELECT?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,this.startPagingRow=this.pageSelectorType===f.SELECT?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t+1)),this.emitter.emit("after-page-change",e,t+1))},e.prototype.changeResultsPerPage=function(t){this.isEnabled()&&!isNaN(t)&&(this.resultsPerPageSlc.value=t,this.onChangeResultsPerPage())},e.prototype.onChangeResultsPerPage=function(){var t=this.tf;if(this.isEnabled()){this.emitter.emit("before-page-length-change",t);var e=this.resultsPerPageSlc,i=e.selectedIndex,n=this.pageSelectorType===f.SELECT?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[i].value,10),this.startPagingRow=this.pagingLength*n,!isNaN(this.pagingLength)&&(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===f.SELECT)){var s=this.pagingSlc.options.length-1<=n?this.pagingSlc.options.length-1:n;this.pagingSlc.options[s].selected=!0}this.emitter.emit("after-page-length-change",t,this.pagingLength)}},e.prototype.resetPage=function(){var t=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page",t);var e=t.feature("store").getPageNb();""!==e&&this.changePage(e-1),this.emitter.emit("after-reset-page",t,e)}},e.prototype.resetPageLength=function(){var t=this.tf;if(this.isEnabled()){this.emitter.emit("before-reset-page-length",t);var e=t.feature("store").getPageLength();""!==e&&(this.resultsPerPageSlc.options[e].selected=!0,this.changeResultsPerPage()),this.emitter.emit("after-reset-page-length",t,e)}},e.prototype.destroy=function(){var t=this,e=this.tf;if(this.initialized){var i=(0,l.elm)(this.prfxBtnNextSpan+e.id),n=(0,l.elm)(this.prfxBtnPrevSpan+e.id),s=(0,l.elm)(this.prfxBtnLastSpan+e.id),r=(0,l.elm)(this.prfxBtnFirstSpan+e.id),a=(0,l.elm)(this.prfxPgBeforeSpan+e.id),o=(0,l.elm)(this.prfxPgAfterSpan+e.id),u=(0,l.elm)(this.prfxPgSpan+e.id),h=this.evt;this.pagingSlc&&(this.pageSelectorType===f.SELECT?(0,c.removeEvt)(this.pagingSlc,"change",h.slcPagesChange):this.pageSelectorType===f.INPUT&&(0,c.removeEvt)(this.pagingSlc,"keypress",h._detectKey),(0,l.removeElm)(this.pagingSlc)),i&&((0,c.removeEvt)(i,"click",h.next),(0,l.removeElm)(i)),n&&((0,c.removeEvt)(n,"click",h.prev),(0,l.removeElm)(n)),s&&((0,c.removeEvt)(s,"click",h.last),(0,l.removeElm)(s)),r&&((0,c.removeEvt)(r,"click",h.first),(0,l.removeElm)(r)),a&&(0,l.removeElm)(a),o&&(0,l.removeElm)(o),u&&(0,l.removeElm)(u),this.hasResultsPerPage&&this.removeResultsPerPage(),this.emitter.off(["after-filtering"],function(){return t.resetPagingInfo()}),this.emitter.off(["change-page"],function(e,i){return t.setPage(i)}),this.emitter.off(["change-page-results"],function(e,i){return t.changeResultsPerPage(i)}),this.pagingSlc=null,this.nbPages=0,this.disable(),this.initialized=!1}},e}(o.Feature)},function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.ClearButton=void 0;var a=i(9),o=i(3),l=i(1);e.ClearButton=function(t){function e(i){n(this,e);var r=s(this,t.call(this,i,"btnReset")),a=r.config;return r.targetId=a.btn_reset_target_id||null,r.element=null,r.text=a.btn_reset_text||"Reset",r.cssClass=a.btn_reset_css_class||"reset",r.tooltip=a.btn_reset_tooltip||"Clear filters",r.html=a.btn_reset_html||(i.enableIcons?'':null),r.prfxCont="resetspan_",r}return r(e,t),e.prototype.onClick=function(){this.isEnabled()&&this.tf.clearFilters()},e.prototype.init=function(){var t=this,e=this.tf;if(!this.initialized){var i=(0,o.createElm)("span",["id",this.prfxCont+e.id]);this.targetId||e.setToolbar();var n=this.targetId?(0,o.elm)(this.targetId):e.rDiv;if(n.appendChild(i),this.html){i.innerHTML=this.html;var s=i.firstChild;(0,l.addEvt)(s,"click",function(){return t.onClick()})}else{var r=(0,o.createElm)("a",["href","javascript:void(0);"]);r.className=this.cssClass,r.appendChild((0,o.createText)(this.text)),i.appendChild(r),(0,l.addEvt)(r,"click",function(){return t.onClick()})}this.element=i.firstChild,this.initialized=!0}},e.prototype.destroy=function(){var t=this.tf;if(this.initialized){var e=(0,o.elm)(this.prfxCont+t.id);e&&(0,o.removeElm)(e),this.element=null,this.initialized=!1}},e}(a.Feature)},function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.Help=void 0;var a=i(9),o=i(3),l=i(1),u=i(10),c="https://github.com/koalyptus/TableFilter/wiki/4.-Filter-operators",f="http://koalyptus.github.io/TableFilter/";e.Help=function(t){function e(i){n(this,e);var r=s(this,t.call(this,i,"help")),a=r.config;return r.tgtId=a.help_instructions_target_id||null,r.contTgtId=a.help_instructions_container_target_id||null,r.instrText=a.help_instructions_text?a.help_instructions_text:'Use the filters above each column to filter and limit table data. Advanced searches can be performed by using the following operators:
<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
Learn more
',r.instrHtml=a.help_instructions_html||null,r.btnText=a.help_instructions_btn_text||"?",r.btnHtml=a.help_instructions_btn_html||null,r.btnCssClass=a.help_instructions_btn_css_class||"helpBtn",r.contCssClass=a.help_instructions_container_css_class||"helpCont",r.btn=null,r.cont=null,r.defaultHtml='

TableFilter v'+i.version+'

'+f+"
©2015-"+i.year+' Max Guglielmi
',r.prfxHelpSpan="helpSpan_",r.prfxHelpDiv="helpDiv_",r.emitter.on(["init-help"],function(){return r.init()}),r}return r(e,t),e.prototype.init=function(){var t=this;if(!this.initialized){var e=this.tf,i=(0,o.createElm)("span",["id",this.prfxHelpSpan+e.id]),n=(0,o.createElm)("div",["id",this.prfxHelpDiv+e.id]);this.tgtId||e.setToolbar();var s=this.tgtId?(0,o.elm)(this.tgtId):e.rDiv;s.appendChild(i);var r=this.contTgtId?(0,o.elm)(this.contTgtId):i;if(this.btnHtml){i.innerHTML=this.btnHtml;var a=i.firstChild;(0,l.addEvt)(a,"click",function(){return t.toggle()}),r.appendChild(n)}else{r.appendChild(n);var u=(0,o.createElm)("a",["href","javascript:void(0);"]);u.className=this.btnCssClass,u.appendChild((0,o.createText)(this.btnText)),i.appendChild(u),(0,l.addEvt)(u,"click",function(){return t.toggle()})}this.instrHtml?(this.contTgtId&&r.appendChild(n),n.innerHTML=this.instrHtml,this.contTgtId||(n.className=this.contCssClass,(0,l.addEvt)(n,"dblclick",function(){return t.toggle()}))):(n.innerHTML=this.instrText,n.className=this.contCssClass,(0,l.addEvt)(n,"dblclick",function(){ return t.toggle()})),n.innerHTML+=this.defaultHtml,(0,l.addEvt)(n,"click",function(){return t.toggle()}),this.cont=n,this.btn=i,this.initialized=!0}},e.prototype.toggle=function(){if(this.enabled!==!1){var t=this.cont.style.display;""===t||t===u.NONE?this.cont.style.display="inline":this.cont.style.display=u.NONE}},e.prototype.destroy=function(){this.initialized&&((0,o.removeElm)(this.btn),this.btn=null,this.cont&&((0,o.removeElm)(this.cont),this.cont=null,this.initialized=!1))},e}(a.Feature)},function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.AlternateRows=void 0;var a=i(9),o=i(3);e.AlternateRows=function(t){function e(i){n(this,e);var r=s(this,t.call(this,i,"alternateRows")),a=r.config;return r.evenCss=a.even_row_css_class||"even",r.oddCss=a.odd_row_css_class||"odd",r}return r(e,t),e.prototype.init=function(){var t=this;this.initialized||(this.processAll(),this.emitter.on(["row-processed","row-paged"],function(e,i,n,s){return t.processRow(i,n,s)}),this.emitter.on(["column-sorted"],function(){return t.processAll()}),this.initialized=!0)},e.prototype.processAll=function(){if(this.isEnabled())for(var t=this.tf,e=t.getValidRows(!0),i=e.length,n=0,s=0;s0?this.hide():this.show()},e.prototype.show=function(){this.initialized&&this.isEnabled()&&(this.onBeforeShow&&this.onBeforeShow.call(null,this.tf,this),this.setWidth(),this.cont.style.display="block",this.onAfterShow&&this.onAfterShow.call(null,this.tf,this))},e.prototype.hide=function(){this.initialized&&this.isEnabled()&&(this.onBeforeHide&&this.onBeforeHide.call(null,this.tf,this),this.cont.style.display=u.NONE,this.onAfterHide&&this.onAfterHide.call(null,this.tf,this))},e.prototype.setWidth=function(){if(this.initialized&&!this.isExternal&&this.isEnabled()){var t=this.tf;if(t.gridLayout){var e=t.feature("gridLayout");this.cont.style.width=e.tblCont.clientWidth+"px"}else this.cont.style.width=(t.tbl.tHead?t.tbl.tHead.clientWidth:t.tbl.tBodies[0].clientWidth)+"px"}},e.prototype.destroy=function(){var t=this;this.initialized&&((0,o.removeElm)(this.cont),this.cont=null,this.emitter.off(["after-filtering"],function(){return t.toggle()}),this.initialized=!1)},e}(a.Feature)},function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.State=void 0;var a=i(9),o=i(26),l=i(27),u=i(5),c=i(4);e.State=function(t){function e(i){n(this,e);var r=s(this,t.call(this,i,"state")),a=r.config.state;return r.enableHash=a===!0||(0,c.isArray)(a.types)&&a.types.indexOf("hash")!==-1,r.enableLocalStorage=(0,c.isArray)(a.types)&&a.types.indexOf("local_storage")!==-1,r.enableCookie=(0,c.isArray)(a.types)&&a.types.indexOf("cookie")!==-1,r.persistFilters=a.filters!==!1,r.persistPageNumber=Boolean(a.page_number),r.persistPageLength=Boolean(a.page_length),r.persistSort=Boolean(a.sort),r.persistColsVisibility=Boolean(a.columns_visibility),r.persistFiltersVisibility=Boolean(a.filters_visibility),r.cookieDuration=isNaN(a.cookie_duration)?87600:parseInt(a.cookie_duration,10),r.enableStorage=r.enableLocalStorage||r.enableCookie,r.storage=null,r.hash=null,r.pageNb=null,r.pageLength=null,r.sort=null,r.hiddenCols=null,r.filtersVisibility=null,r.state={},r.prfxCol="col_",r.pageNbKey="page",r.pageLengthKey="page_length",r.filtersVisKey="filters_visibility",r}return r(e,t),e.prototype.init=function(){var t=this;this.initialized||(this.emitter.on(["after-filtering"],function(){return t.update()}),this.emitter.on(["after-page-change","after-clearing-filters"],function(e,i){return t.updatePage(i)}),this.emitter.on(["after-page-length-change"],function(e,i){return t.updatePageLength(i)}),this.emitter.on(["column-sorted"],function(e,i,n){return t.updateSort(i,n)}),this.emitter.on(["sort-initialized"],function(){return t._syncSort()}),this.emitter.on(["columns-visibility-initialized"],function(){return t._syncColsVisibility()}),this.emitter.on(["column-shown","column-hidden"],function(e,i,n,s){return t.updateColsVisibility(s)}),this.emitter.on(["filters-visibility-initialized"],function(){return t._syncFiltersVisibility()}),this.emitter.on(["filters-toggled"],function(e,i,n){return t.updateFiltersVisibility(n)}),this.enableHash&&(this.hash=new o.Hash(this),this.hash.init()),this.enableStorage&&(this.storage=new l.Storage(this),this.storage.init()),this.initialized=!0)},e.prototype.update=function(){var t=this;if(this.isEnabled()){var e=this.state,i=this.tf;if(this.persistFilters){var n=i.getFiltersValue();n.forEach(function(i,n){var s=""+t.prfxCol+n;(0,c.isString)(i)&&(0,u.isEmpty)(i)?e.hasOwnProperty(s)&&(e[s].flt=void 0):(e[s]=e[s]||{},e[s].flt=i)})}if(this.persistPageNumber&&((0,c.isNull)(this.pageNb)?e[this.pageNbKey]=void 0:e[this.pageNbKey]=this.pageNb),this.persistPageLength&&((0,c.isNull)(this.pageLength)?e[this.pageLengthKey]=void 0:e[this.pageLengthKey]=this.pageLength),this.persistSort&&!(0,c.isNull)(this.sort)){Object.keys(e).forEach(function(i){i.indexOf(t.prfxCol)!==-1&&e[i]&&(e[i].sort=void 0)});var s=""+this.prfxCol+this.sort.column;e[s]=e[s]||{},e[s].sort={descending:this.sort.descending}}this.persistColsVisibility&&((0,c.isNull)(this.hiddenCols)||(Object.keys(e).forEach(function(i){i.indexOf(t.prfxCol)!==-1&&e[i]&&(e[i].hidden=void 0)}),this.hiddenCols.forEach(function(i){var n=""+t.prfxCol+i;e[n]=e[n]||{},e[n].hidden=!0}))),this.persistFiltersVisibility&&((0,c.isNull)(this.filtersVisibility)?e[this.filtersVisKey]=void 0:e[this.filtersVisKey]=this.filtersVisibility),this.emitter.emit("state-changed",i,e)}},e.prototype.updatePage=function(t){this.pageNb=t,this.update()},e.prototype.updatePageLength=function(t){this.pageLength=t,this.update()},e.prototype.updateSort=function(t,e){this.sort={column:t,descending:e},this.update()},e.prototype.updateColsVisibility=function(t){this.hiddenCols=t,this.update()},e.prototype.updateFiltersVisibility=function(t){this.filtersVisibility=t,this.update()},e.prototype.override=function(t){this.state=t},e.prototype.sync=function(){var t=this.state,e=this.tf;if(this._syncFilters(),this.persistPageNumber){var i=t[this.pageNbKey];this.emitter.emit("change-page",e,i)}if(this.persistPageLength){var n=t[this.pageLengthKey];this.emitter.emit("change-page-results",e,n)}this._syncSort(),this._syncColsVisibility(),this._syncFiltersVisibility()},e.prototype.overrideAndSync=function(t){this.disable(),this.override(t),this.sync(),this.enable()},e.prototype._syncFilters=function(){var t=this;if(this.persistFilters){var e=this.state,i=this.tf;Object.keys(e).forEach(function(n){if(n.indexOf(t.prfxCol)!==-1){var s=parseInt(n.replace(t.prfxCol,""),10),r=e[n].flt;i.setFilterValue(s,r)}}),i.filter()}},e.prototype._syncSort=function(){var t=this;if(this.persistSort){var e=this.state,i=this.tf;Object.keys(e).forEach(function(n){if(n.indexOf(t.prfxCol)!==-1){var s=parseInt(n.replace(t.prfxCol,""),10);if(!(0,c.isUndef)(e[n].sort)){var r=e[n].sort;t.emitter.emit("sort",i,s,r.descending)}}})}},e.prototype._syncColsVisibility=function(){var t=this;if(this.persistColsVisibility){var e=this.state,i=this.tf,n=[];Object.keys(e).forEach(function(i){if(i.indexOf(t.prfxCol)!==-1){var s=parseInt(i.replace(t.prfxCol,""),10);(0,c.isUndef)(e[i].hidden)||n.push(s)}}),n.forEach(function(e){t.emitter.emit("hide-column",i,e)})}},e.prototype._syncFiltersVisibility=function(){if(this.persistFiltersVisibility){var t=this.state,e=this.tf,i=t[this.filtersVisKey];this.filtersVisibility=i,this.emitter.emit("show-filters",e,i)}},e.prototype.destroy=function(){var t=this;this.initialized&&(this.state={},this.emitter.off(["after-filtering"],function(){return t.update()}),this.emitter.off(["after-page-change","after-clearing-filters"],function(e,i){return t.updatePage(i)}),this.emitter.off(["after-page-length-change"],function(e,i){return t.updatePageLength(i)}),this.emitter.off(["column-sorted"],function(e,i,n){return t.updateSort(i,n)}),this.emitter.off(["sort-initialized"],function(){return t._syncSort()}),this.emitter.off(["columns-visibility-initialized"],function(){return t._syncColsVisibility()}),this.emitter.off(["column-shown","column-hidden"],function(e,i,n,s){return t.updateColsVisibility(s)}),this.emitter.off(["filters-visibility-initialized"],function(){return t._syncFiltersVisibility()}),this.emitter.off(["filters-toggled"],function(e,i,n){return t.updateFiltersVisibility(n)}),this.enableHash&&(this.hash.destroy(),this.hash=null),this.enableStorage&&(this.storage.destroy(),this.storage=null),this.initialized=!1)},e}(a.Feature)},function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=e.hasHashChange=void 0;var s=i(1),r=i(2),a=r.root.JSON,o=r.root.location,l=r.root.decodeURIComponent,u=r.root.encodeURIComponent,c=e.hasHashChange=function(){var t=r.root.documentMode;return"onhashchange"in r.root&&(void 0===t||t>7)};e.Hash=function(){function t(e){n(this,t),this.state=e,this.lastHash=null,this.emitter=e.emitter,this.boundSync=null}return t.prototype.init=function(){var t=this;c()&&(this.lastHash=o.hash,this.boundSync=this.sync.bind(this),this.emitter.on(["state-changed"],function(e,i){return t.update(i)}),this.emitter.on(["initialized"],this.boundSync),(0,s.addEvt)(r.root,"hashchange",this.boundSync))},t.prototype.update=function(t){var e="#"+u(a.stringify(t));this.lastHash!==e&&(o.hash=e,this.lastHash=e)},t.prototype.parse=function(t){return t.indexOf("#")===-1?null:(t=t.substr(1),a.parse(l(t)))},t.prototype.sync=function(){var t=this.parse(o.hash);t&&this.state.overrideAndSync(t)},t.prototype.destroy=function(){var t=this;this.emitter.off(["state-changed"],function(e,i){return t.update(i)}),this.emitter.off(["initialized"],this.boundSync),(0,s.removeEvt)(r.root,"hashchange",this.boundSync),this.state=null,this.lastHash=null,this.emitter=null},t}()},function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.Storage=e.hasStorage=void 0;var r=i(28),a=n(r),o=i(2),l=o.root.JSON,u=o.root.localStorage,c=o.root.location,f=e.hasStorage=function(){return"Storage"in o.root};e.Storage=function(){function t(e){s(this,t),this.state=e,this.tf=e.tf,this.enableLocalStorage=e.enableLocalStorage&&f(),this.enableCookie=e.enableCookie&&!this.enableLocalStorage,this.emitter=e.emitter,this.duration=e.cookieDuration}return t.prototype.init=function(){var t=this;this.emitter.on(["state-changed"],function(e,i){return t.save(i)}),this.emitter.on(["initialized"],function(){return t.sync()})},t.prototype.save=function(t){this.enableLocalStorage?u[this.getKey()]=l.stringify(t):a["default"].write(this.getKey(),l.stringify(t),this.duration)},t.prototype.retrieve=function(){var t=null;return t=this.enableLocalStorage?u[this.getKey()]:a["default"].read(this.getKey()),t?l.parse(t):null},t.prototype.remove=function(){this.enableLocalStorage?u.removeItem(this.getKey()):a["default"].remove(this.getKey())},t.prototype.sync=function(){var t=this.retrieve();t&&this.state.overrideAndSync(t)},t.prototype.getKey=function(){return l.stringify({key:this.tf.prfxTf+"_"+this.tf.id,path:c.pathname})},t.prototype.destroy=function(){var t=this;this.emitter.off(["state-changed"],function(e,i){return t.save(i)}),this.emitter.off(["initialized"],function(){return t.sync()}),this.remove(),this.state=null,this.emitter=null},t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(2),s=n.root.document;e["default"]={write:function(t,e,i){var n="";i&&(n=new Date((new Date).getTime()+36e5*i),n="; expires="+n.toGMTString()),s.cookie=t+"="+escape(e)+n},read:function(t){var e="",i=t+"=";if(s.cookie.length>0){var n=s.cookie,r=n.indexOf(i);if(r!==-1){r+=i.length;var a=n.indexOf(";",r);a===-1&&(a=n.length),e=unescape(n.substring(r,a))}}return e},remove:function(t){this.write(t,"",-1)}}},function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.DateType=void 0;var a=i(30);i(416);var o=i(9),l=i(4),u=i(10);e.DateType=function(t){function e(i){n(this,e);var r=s(this,t.call(this,i,"dateType"));return r.locale=i.locale,r.datetime=a.Date,r.enable(),r}return r(e,t),e.prototype.init=function(){this.initialized||(this.datetime.setLocale(this.locale),this.addConfigFormats(this.tf.colTypes),this.emitter.emit("date-type-initialized",this.tf,this),this.initialized=!0)},e.prototype.parse=function(t,e){return this.datetime.create(t,e)},e.prototype.isValid=function(t,e){return this.datetime.isValid(this.parse(t,e))},e.prototype.getOptions=function(t,e){e=e||this.tf.colTypes;var i=e[t];return(0,l.isObj)(i)?i:{}},e.prototype.addConfigFormats=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.forEach(function(i,n){var s=t.getOptions(n,e);s.type===u.DATE&&s.hasOwnProperty("format")&&!function(){var e=t.datetime.getLocale(s.locale||t.locale);(0,l.isArray)(s.format)?s.format.forEach(function(t){e.addFormat(t)}):e.addFormat(s.format)}()})},e.prototype.destroy=function(){this.initialized&&(this.initialized=!1)},e}(o.Feature)},function(t,e,i){"use strict";i(31),i(369),t.exports=i(33)},function(t,e,i){"use strict";i(32),i(92),i(138),i(140),i(141),i(142),i(143),i(144),i(151),i(152),i(153),i(154),i(155),i(156),i(157),i(158),i(159),i(160),i(161),i(162),i(163),i(164),i(165),i(166),i(167),i(168),i(169),i(170),i(171),i(172),i(173),i(174),i(175),i(176),i(177),i(178),i(179),i(180),i(181),i(182),i(183),i(184),i(185),i(186),i(187),i(188),i(189),i(190),i(191),i(192),i(193),i(194),i(195),i(196),i(197),i(198),i(199),i(200),i(201),i(202),i(203),i(204),i(205),i(206),i(207),i(208),i(209),i(210),i(211),i(212),i(213),i(214),i(215),i(216),i(217),i(218),i(219),i(220),i(221),i(222),i(223),i(224),i(225),i(226),i(227),i(228),i(229),i(230),i(231),i(239),i(240),i(241),i(242),i(243),i(244),i(245),i(246),i(251),i(252),i(253),i(254),i(255),i(256),i(257),i(258),i(259),i(260),i(261),i(262),i(263),i(264),i(265),i(266),i(267),i(286),i(287),i(288),i(289),i(290),i(291),i(292),i(293),i(294),i(295),i(299),i(300),i(301),i(302),i(305),i(306),i(307),i(308),i(309),i(310),i(311),i(312),i(313),i(314),i(315),i(316),i(317),i(318),i(319),i(320),i(321),i(322),i(323),i(324),i(326),i(327),i(328),i(329),i(330),i(331),i(332),i(333),i(334),i(335),i(336),i(337),i(338),i(339),i(340),i(341),i(342),i(343),i(344),i(347),i(348),i(350),i(351),i(352),i(353),i(354),i(355),i(356),i(357),i(358),i(359),i(360),i(361),i(362),i(363),i(364),i(365),i(366),i(367),i(368),t.exports=i(33)},function(t,e,i){"use strict";var n=i(33),s=i(34),r=s.localeManager;n.Date.defineStatic({addLocale:function(t,e){return r.add(t,e)}}),t.exports=n.Date.addLocale},function(t,e){(function(e){(function(){"use strict";function i(){if(S=D[N],!S){if(S=function(t){return U(S,function(e,i){T(A,i)&&e.extend(t)}),S},R)t.exports=S;else try{D[N]=S}catch(e){}U(O.split(" "),function(t){n(t)}),s()}}function n(t){function e(t,e,i){C(n,t,function(t,s,r){var l=o(t,s,r);return a(n,l.methods,e,i,l.last),n})}var i="Object"===t,n=d(t,!0),s=function(e){function s(t,e){return i&&e===p&&(!M||"get"===t||"set"===t)}function r(t,i){var n=e[t];if(n)for(var s,r=0;s=n[r];r++)if(s===i)return!0;return!1}function a(t,i){return e[t]&&!r(t,i)}function o(t,i,n){if(!i[t]||!n)return!1;for(var s=0;s0&&s%10===0,i?(e&&(o+=a),l?a=s:o+=s):(o+=s*a,a*=10),e=i;return o},getOrdinal:function(t){var e=this.ordinalSuffix;return e||v(t)},getRelativeFormat:function(t,e){return this.convertAdjustedToFormat(t,e)},getDuration:function(t){return this.convertAdjustedToFormat(T(I(0,t)),"duration")},getFirstDayOfWeek:function(){var t=this.firstDayOfWeek;return h(t)?t:D},getFirstDayOfWeekYear:function(){return this.firstDayOfWeekYear||R},convertAdjustedToFormat:function(t,e){var i,n,s,r=t[0],a=t[1],o=t[2],l=this[e]||this.relative;return A(l)?l.call(this,r,a,o,e):(s=this.plural&&1!==r?1:0,n=this.units[8*s+a]||this.units[a],i=this[o>0?"fromNow":"ago"],l.replace(/\{(.*?)\}/g,function(t,e){switch(e){case"num":return r;case"unit":return n;case"sign":return i}}))},cacheFormat:function(t,e){this.compiledFormats.splice(e,1),this.compiledFormats.unshift(t)},addFormat:function(t,e){function i(t){var i,r,o,l=t.match(/\?$/),u=t.match(/^(\d+)\??$/),f=t.match(/(\d)(?:-(\d))?/),h=t.replace(/[^a-z]+$/i,"");return(o=S(s.parsingAliases,h))?(r=n(o),l&&(r=b(r,!0)),r):(u?r=s.tokens[u[1]]:(o=S(a,h))?r=o.src:(o=S(s.parsingTokens,h)||S(s,h),h=h.replace(/s$/,""),o||(o=S(s.parsingTokens,h)||S(s,h+"s")),M(o)?(r=o,i=s[h+"Suffix"]):(f&&(o=c(o,function(t,e){var i=e%(s.units?8:o.length);return i>=f[1]&&i<=(f[2]||f[1])})),r=C(o))),r?(u?r=b(r):(e.push(h),r="("+r+")"),i&&(r=k(h,r,i)),l&&(r+="?"),r):"")}function n(t){return t=t.replace(/ /g," ?"),t.replace(/\{([^,]+?)\}/g,function(t,e){var n,s=e.split("|");return n=s.length>1?b(u(s,i).join("|")):i(e)})}var s=this;e||(e=[],t=n(t)),s.addRawFormat(t,e)},addRawFormat:function(t,e){this.compiledFormats.unshift({reg:RegExp("^ *"+t+" *$","i"),to:e})},init:function(t){function e(){L.compiledFormats=[],L.parsingAliases={},L.parsingTokens={}}function i(){y(L,t)}function n(){f(s,function(t){var e=L[t];M(e)?L[t]=d(e):e||(L[t]=[])})}function r(t,e,i,n){var s,r=t,a=[];L[r]||(r+="s"),i||(i={},s=!0),c(r,function(t,s,r){var o,l=s*e+r;o=n?n(r):r,i[t]=o,i[t.toLowerCase()]=o,a[l]=t}),L[r]=a,s&&(L[t+"Map"]=i)}function c(t,e){f(L[t],function(t,i){h(t,function(t,n){e(t,n,i)})})}function h(t,e){var i=u(t.split("+"),function(t){return t.replace(/(.+):(.+)$/,function(t,e,i){return u(i.split("|"),function(t){return e+t}).join("|")})}).join("|");f(i.split("|"),e)}function p(){var t={};r("numeral",10,t),r("article",1,t,function(){return 1}),r("placeholder",4,t,function(t){return P(10,t+1)}),L.numeralMap=t}function m(){L.parsingAliases.time=g(),L.parsingAliases.tzOffset=v()}function g(){var t;return t=L.ampmFront?"{ampm?} {hour} (?:{minute} (?::?{second})?)?":L.ampm.length?"{hour}(?:[.:]{minute}(?:[.:]{second})? {ampm?}| {ampm})":"{hour}(?:[.:]{minute}(?:[.:]{second})?)"}function v(){return"(?:{Z}|{GMT?}(?:{tzSign}{tzHour}(?::?{tzMinute}(?: \\([\\w\\s]+\\))?)?)?)?"}function x(){N(l,function(t,e){var i,n;i=t.base?a[t.base].src:t.src,(t.requiresNumerals||L.numeralUnits)&&(i+=_()),n=L[e+"s"],n&&n.length&&(i+="|"+C(n)),L.parsingTokens[e]=i})}function _(){var t,e="";return t=L.numerals.concat(L.placeholders).concat(L.articles),L.allowsFullWidth&&(t=t.concat(F.split(""))),t.length&&(e="|(?:"+C(t)+")+"),e}function E(){w(function(t,e){var i=L.timeSuffixes[e];i&&(L[(t.alias||t.name)+"Suffix"]=i)})}function T(){f(L.modifiers,function(t){var e,i=t.name,n=i+"Map"; diff --git a/dist/tablefilter/tf-1.js b/dist/tablefilter/tf-1.js index 0c405fea..a651b347 100644 --- a/dist/tablefilter/tf-1.js +++ b/dist/tablefilter/tf-1.js @@ -1,6 +1,6 @@ /** - * tablefilter v0.3.0 by Max Guglielmi - * build date: 2016-10-03T05:58:32.886Z + * tablefilter v0.3.1 by Max Guglielmi + * build date: 2016-10-08T00:44:54.619Z * MIT License */ diff --git a/package.json b/package.json index 0ff20bff..873e4b8d 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "grunt-string-replace": "^1.3.1", "grunt-webpack": "^1.0.16", "script-loader": "^0.7.0", - "string-replace-webpack-plugin": "^0.0.3", + "string-replace-webpack-plugin": "^0.0.4", "sugar-date": "2.0.0", "webpack": "^1.13.2", "webpack-dev-server": "^1.16.2" diff --git a/test/test-col-ops.html b/test/test-col-ops.html index 4c7182f8..698394b2 100644 --- a/test/test-col-ops.html +++ b/test/test-col-ops.html @@ -11,12 +11,19 @@ - + + + + + + + + @@ -31,6 +38,27 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/test/test-col-ops.js b/test/test-col-ops.js index 9b09796b..66658ae8 100644 --- a/test/test-col-ops.js +++ b/test/test-col-ops.js @@ -6,6 +6,10 @@ var totRowIndex = table.getElementsByTagName('tr').length; var tf = new TableFilter('demo', { base_path: '../dist/tablefilter/', rows_always_visible: [ + totRowIndex-6, + totRowIndex-5, + totRowIndex-4, + totRowIndex-3, totRowIndex-2, totRowIndex-1, totRowIndex, @@ -14,31 +18,63 @@ var tf = new TableFilter('demo', { name: 'colOps', id: [ 'sum1', 'sum2', + 'mean1', 'mean2', 'min1', 'min2', - 'max1', 'max2' + 'max1', 'max2', + 'median1', 'median2', + 'q1-1', 'q1-2', + 'q3-1', 'q3-2' ], col: [ + 2, 3, + 2, 3, + 2, 3, + 2, 3, 2, 3, 2, 3, 2, 3 ], operation: [ - 'sum', 'mean', + 'sum', 'sum', + 'mean', 'mean', 'min', 'min', - 'max', 'max' + 'max', 'max', + 'median', 'median', + 'q1', 'q1', + 'q3', 'q3' ], write_method: [ + 'innerhtml', 'innerhtml', + 'innerhtml', 'innerhtml', + 'innerhtml', 'innerhtml', + 'innerhtml', 'innerhtml', 'innerhtml', 'innerhtml', 'innerhtml', 'innerhtml', 'innerhtml', 'innerhtml' ], exclude_row: [ + totRowIndex-6, + totRowIndex-5, + totRowIndex-4, + totRowIndex-3, totRowIndex-2, totRowIndex-1, totRowIndex ], - decimal_precision: [0, 2], + decimal_precision: [ + 0, 2, + 0, 2, + 0, 2, + 0, 2, + 0, 2, + 0, 2, + 0, 2 + ], tot_row_index: [ + totRowIndex-6, totRowIndex-6, + totRowIndex-5, totRowIndex-5, + totRowIndex-4, totRowIndex-4, + totRowIndex-3, totRowIndex-3, totRowIndex-2, totRowIndex-2, totRowIndex-1, totRowIndex-1, totRowIndex, totRowIndex @@ -52,9 +88,19 @@ test('Column operations', function() { var colOps = tf.extension('colOps'); deepEqual(typeof colOps, 'object', 'ColOps instanciated'); equal(id('sum1').innerHTML, 9911, 'Sum result'); - equal(id('sum2').innerHTML, 1.69, 'Mean result'); - equal(id('min1').innerHTML, 286.00, 'Min result'); + equal(id('sum2').innerHTML, 11.85, 'Sum result'); + equal(id('mean1').innerHTML, 1416, 'Mean result'); + equal(id('mean2').innerHTML, 1.69, 'Mean result'); + equal(id('min1').innerHTML, 286, 'Min result'); equal(id('min2').innerHTML, 0.60, 'Min result'); + equal(id('max1').innerHTML, 2781, 'Max result'); + equal(id('max2').innerHTML, 3.10, 'Max result'); + equal(id('median1').innerHTML, 1412, 'Median result'); + equal(id('median2').innerHTML, 1.50, 'Median result'); + equal(id('q1-1').innerHTML, 872, 'Q1 result'); + equal(id('q1-2').innerHTML, 1.10, 'Q1 result'); + equal(id('q3-1').innerHTML, 2045, 'Q3 result'); + equal(id('q3-2').innerHTML, 2.15, 'Q3 result'); }); module('Behaviour checks'); @@ -62,41 +108,138 @@ test('Column operations after filtering', function() { tf.setFilterValue(0, 'syd'); tf.filter(); equal(id('sum1').innerHTML, 3552, 'Sum result'); - equal(id('sum2').innerHTML, 1.15, 'Mean result'); - equal(id('min1').innerHTML, 286.00, 'Min result'); + equal(id('sum2').innerHTML, 4.60, 'Sum result'); + equal(id('mean1').innerHTML, 888, 'Mean result'); + equal(id('mean2').innerHTML, 1.15, 'Mean result'); + equal(id('min1').innerHTML, 286, 'Min result'); equal(id('min2').innerHTML, 0.60, 'Min result'); + equal(id('max1').innerHTML, 1412, 'Max result'); + equal(id('max2').innerHTML, 1.50, 'Max result'); + equal(id('median1').innerHTML, 927, 'Median result'); + equal(id('median2').innerHTML, 1.25, 'Median result'); + equal(id('q1-1').innerHTML, 579, 'Q1 result'); + equal(id('q1-2').innerHTML, 0.85, 'Q1 result'); + equal(id('q3-1').innerHTML, 1197, 'Q3 result'); + equal(id('q3-2').innerHTML, 1.45, 'Q3 result'); tf.clearFilters(); }); -// module('Behaviour checks with grid layout'); -// test('Column operations', function() { -// tf.destroy(); -// tf = null; -// totRowIndex = totRowIndex-2; -// tf = new TableFilter('demo', { -// base_path: '../dist/tablefilter/', -// grid_layout: true, -// rows_always_visible: [totRowIndex], -// extensions: [{ -// name: 'colOps', -// id: ['sum1', 'sum2'], -// col: [2, 3], -// operation: ['sum', 'mean'], -// write_method: ['innerhtml', 'innerhtml'], -// exclude_row: [totRowIndex], -// decimal_precision: [0, 2], -// tot_row_index: [totRowIndex, totRowIndex] -// }] -// }); -// tf.init(); +module('Behaviour checks with grid layout'); +test('Column operations', function() { + tf.destroy(); + totRowIndex = totRowIndex-2; + tf = new TableFilter('demo', { + base_path: '../dist/tablefilter/', + grid_layout: true, + rows_always_visible: [ + totRowIndex-6, + totRowIndex-5, + totRowIndex-4, + totRowIndex-3, + totRowIndex-2, + totRowIndex-1, + totRowIndex, + ], + extensions: [{ + name: 'colOps', + id: [ + 'sum1', 'sum2', + 'mean1', 'mean2', + 'min1', 'min2', + 'max1', 'max2', + 'median1', 'median2', + 'q1-1', 'q1-2', + 'q3-1', 'q3-2' + ], + col: [ + 2, 3, + 2, 3, + 2, 3, + 2, 3, + 2, 3, + 2, 3, + 2, 3 + ], + operation: [ + 'sum', 'sum', + 'mean', 'mean', + 'min', 'min', + 'max', 'max', + 'median', 'median', + 'q1', 'q1', + 'q3', 'q3' + ], + write_method: [ + 'innerhtml', 'innerhtml', + 'innerhtml', 'innerhtml', + 'innerhtml', 'innerhtml', + 'innerhtml', 'innerhtml', + 'innerhtml', 'innerhtml', + 'innerhtml', 'innerhtml', + 'innerhtml', 'innerhtml' + ], + exclude_row: [ + totRowIndex-6, + totRowIndex-5, + totRowIndex-4, + totRowIndex-3, + totRowIndex-2, + totRowIndex-1, + totRowIndex + ], + decimal_precision: [ + 0, 2, + 0, 2, + 0, 2, + 0, 2, + 0, 2, + 0, 2, + 0, 2 + ], + tot_row_index: [ + totRowIndex-6, totRowIndex-6, + totRowIndex-5, totRowIndex-5, + totRowIndex-4, totRowIndex-4, + totRowIndex-3, totRowIndex-3, + totRowIndex-2, totRowIndex-2, + totRowIndex-1, totRowIndex-1, + totRowIndex, totRowIndex + ] + }] + }); + tf.init(); -// equal(id('sum1').innerHTML, 9911, 'Sum result'); -// equal(id('sum2').innerHTML, 1.69, 'Mean result'); + equal(id('sum1').innerHTML, 9911, 'Sum result'); + equal(id('sum2').innerHTML, 11.85, 'Sum result'); + equal(id('mean1').innerHTML, 1416, 'Mean result'); + equal(id('mean2').innerHTML, 1.69, 'Mean result'); + equal(id('min1').innerHTML, 286, 'Min result'); + equal(id('min2').innerHTML, 0.60, 'Min result'); + equal(id('max1').innerHTML, 2781, 'Max result'); + equal(id('max2').innerHTML, 3.10, 'Max result'); + equal(id('median1').innerHTML, 1412, 'Median result'); + equal(id('median2').innerHTML, 1.50, 'Median result'); + equal(id('q1-1').innerHTML, 872, 'Q1 result'); + equal(id('q1-2').innerHTML, 1.10, 'Q1 result'); + equal(id('q3-1').innerHTML, 2045, 'Q3 result'); + equal(id('q3-2').innerHTML, 2.15, 'Q3 result'); -// tf.setFilterValue(2, '>1000'); -// tf.filter(); -// equal(id('sum1').innerHTML, 7771, 'Sum result'); -// equal(id('sum2').innerHTML, 2.16, 'Mean result'); + tf.setFilterValue(2, '>1000'); + tf.filter(); + equal(id('sum1').innerHTML, 7771, 'Sum result'); + equal(id('sum2').innerHTML, 8.65, 'Sum result'); + equal(id('mean1').innerHTML, 1943, 'Mean result'); + equal(id('mean2').innerHTML, 2.16, 'Mean result'); + equal(id('min1').innerHTML, 1412, 'Min result'); + equal(id('min2').innerHTML, 1.40, 'Min result'); + equal(id('max1').innerHTML, 2781, 'Max result'); + equal(id('max2').innerHTML, 3.10, 'Max result'); + equal(id('median1').innerHTML, 1789, 'Median result'); + equal(id('median2').innerHTML, 2.08, 'Median result'); + equal(id('q1-1').innerHTML, 1473, 'Q1 result'); + equal(id('q1-2').innerHTML, 1.70, 'Q1 result'); + equal(id('q3-1').innerHTML, 2413, 'Q3 result'); + equal(id('q3-2').innerHTML, 2.63, 'Q3 result'); -// tf.destroy(); -// }); + tf.destroy(); +});
Tot:Sum:
Mean:
Min:
Median:
Q1:
Q3: