TableFilter/dist/tablefilter/tf-1.js

8 lines
47 KiB
JavaScript

/**
* tablefilter v0.2.65 by Max Guglielmi
* build date: 2016-09-07T11:33:04.337Z
* MIT License
*/
webpackJsonp([1],{30:function(e,t,n){function o(e){return n(i(e))}function i(e){return s[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}var s={"./array":16,"./array.js":16,"./const":11,"./const.js":11,"./cookie":29,"./cookie.js":29,"./date":6,"./date.js":6,"./dom":3,"./dom.js":3,"./emitter":8,"./emitter.js":8,"./event":1,"./event.js":1,"./extensions/advancedGrid/adapterEzEditTable":31,"./extensions/advancedGrid/adapterEzEditTable.js":31,"./extensions/advancedGrid/advancedGrid":32,"./extensions/advancedGrid/advancedGrid.js":32,"./extensions/colOps/colOps":33,"./extensions/colOps/colOps.js":33,"./extensions/colsVisibility/colsVisibility":34,"./extensions/colsVisibility/colsVisibility.js":34,"./extensions/filtersVisibility/filtersVisibility":35,"./extensions/filtersVisibility/filtersVisibility.js":35,"./extensions/sort/adapterSortabletable":36,"./extensions/sort/adapterSortabletable.js":36,"./extensions/sort/sort":37,"./extensions/sort/sort.js":37,"./feature":10,"./feature.js":10,"./helpers":7,"./helpers.js":7,"./modules/alternateRows":24,"./modules/alternateRows.js":24,"./modules/checkList":18,"./modules/checkList.js":18,"./modules/clearButton":22,"./modules/clearButton.js":22,"./modules/dropdown":15,"./modules/dropdown.js":15,"./modules/gridLayout":9,"./modules/gridLayout.js":9,"./modules/hash":27,"./modules/hash.js":27,"./modules/help":23,"./modules/help.js":23,"./modules/highlightKeywords":13,"./modules/highlightKeywords.js":13,"./modules/loader":12,"./modules/loader.js":12,"./modules/noResults":25,"./modules/noResults.js":25,"./modules/paging":21,"./modules/paging.js":21,"./modules/popupFilter":14,"./modules/popupFilter.js":14,"./modules/rowsCounter":19,"./modules/rowsCounter.js":19,"./modules/state":26,"./modules/state.js":26,"./modules/statusBar":20,"./modules/statusBar.js":20,"./modules/storage":28,"./modules/storage.js":28,"./root":2,"./root.js":2,"./sort":17,"./sort.js":17,"./string":5,"./string.js":5,"./types":4,"./types.js":4};o.keys=function(){return Object.keys(s)},o.resolve=i,e.exports=o,o.id=30},31:function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=n(10),r=n(3),a=n(11),d=n(2),c='Failed to instantiate EditTable object.\n \n"ezEditTable" dependency not found.',u=function(e){function t(n,s){o(this,t);var l=i(this,e.call(this,n,s.name));return l.desc=s.description||"ezEditTable adapter",l.filename=s.filename||"ezEditTable.js",l.vendorPath=s.vendor_path,l.loadStylesheet=Boolean(s.load_stylesheet),l.stylesheet=s.stylesheet||l.vendorPath+"ezEditTable.css",l.stylesheetName=s.stylesheet_name||"ezEditTableCss",s.scroll_into_view=s.scroll_into_view===!1?!1:n.gridLayout,l._ezEditTable=null,l.cfg=s,l.enable(),l}return s(t,e),t.prototype.init=function(){var e=this;if(!this.initialized){var t=this.tf;if(d.root.EditTable)this._setAdvancedGrid();else{var n=this.vendorPath+this.filename;t["import"](this.filename,n,function(){return e._setAdvancedGrid()})}this.loadStylesheet&&!t.isImported(this.stylesheet,"link")&&t["import"](this.stylesheetName,this.stylesheet,null,"link"),this.emitter.on(["filter-focus","filter-blur"],function(){return e._toggleForInputFilter()}),this.initialized=!0}},t.prototype._setAdvancedGrid=function(){var e=this.tf,t=void 0,n=this.cfg,o=(0,r.tag)(e.tbl,"thead");t=o.length>0&&!n.startRow?void 0:n.startRow||e.refRow,n.base_path=n.base_path||e.basePath+"ezEditTable/";var i=n.editable,s=n.selection;s&&(n.default_selection=n.default_selection||"row"),n.active_cell_css=n.active_cell_css||"ezETSelectedCell";var l=0,a=0;s&&!function(){var t=function(t,n,o){var i=t.Selection,s=function(o){if("row"===t.defaultSelection)i.SelectRowByIndex(o);else{t.ClearSelections();var s=n.cellIndex,l=e.tbl.rows[o];"both"===t.defaultSelection&&i.SelectRowByIndex(o),l&&i.SelectCell(l.cells[s])}if(e.validRowsIndex.length!==e.getRowsNb()){var r=e.tbl.rows[o];r&&r.scrollIntoView(!1),u&&(u.cellIndex===e.getCellsNb()-1&&e.gridLayout?e.tblCont.scrollLeft=1e8:0===u.cellIndex&&e.gridLayout?e.tblCont.scrollLeft=0:u.scrollIntoView(!1))}};if(e.validRowsIndex){var r=e.validRowsIndex,d=r.length,c="row"!==t.defaultSelection?n.parentNode:n,u="TD"===n.nodeName?n:null,h=void 0!==o?t.Event.GetKey(o):0,p=-1!==r.indexOf(c.rowIndex),f=void 0,b=e.feature("paging"),m=34===h||33===h?b&&b.pagingLength||t.nbRowsPerPage:1;if(p)34!==h&&33!==h?(l=r.indexOf(c.rowIndex),a=c.rowIndex):(f=34===h?d-1>=l+m?r[l+m]:[d-1]:l-m<=r[0]?r[0]:r[l-m],a=f,l=r.indexOf(f),s(f));else{if(c.rowIndex>a)if(c.rowIndex>=r[d-1])f=r[d-1];else{var y=l+m;f=y>d-1?r[d-1]:r[y]}else if(c.rowIndex<=r[0])f=r[0];else{var g=r[l-m];f=g?g:r[0]}a=c.rowIndex,s(f)}}},o=function(t,n){var o="row"!==t.defaultSelection?n.parentNode:n;if(e.paging&&e.feature("paging").nbPages>1){var i=e.feature("paging");t.nbRowsPerPage=i.pagingLength;var s=e.validRowsIndex,l=s.length,r=parseInt(i.startPagingRow,10)+parseInt(i.pagingLength,10),a=o.rowIndex;a===s[l-1]&&i.currentPageNb!==i.nbPages?i.setPage("last"):a===s[0]&&1!==i.currentPageNb?i.setPage("first"):a>s[r-1]&&a<s[l-1]?i.setPage("next"):a<s[i.startPagingRow]&&a>s[0]&&i.setPage("previous")}};e.paging&&(e.feature("paging").onAfterChangePage=function(e){var t=e.tf.extension("advancedGrid"),n=t._ezEditTable,o=n.Selection,i=o.GetActiveRow();i&&i.scrollIntoView(!1);var s=o.GetActiveCell();s&&s.scrollIntoView(!1)}),"row"===n.default_selection?!function(){var e=n.on_before_selected_row;n.on_before_selected_row=function(){o(arguments[0],arguments[1],arguments[2]),e&&e.call(null,arguments[0],arguments[1],arguments[2])};var i=n.on_after_selected_row;n.on_after_selected_row=function(){t(arguments[0],arguments[1],arguments[2]),i&&i.call(null,arguments[0],arguments[1],arguments[2])}}():!function(){var e=n.on_before_selected_cell;n.on_before_selected_cell=function(){o(arguments[0],arguments[1],arguments[2]),e&&e.call(null,arguments[0],arguments[1],arguments[2])};var i=n.on_after_selected_cell;n.on_after_selected_cell=function(){t(arguments[0],arguments[1],arguments[2]),i&&i.call(null,arguments[0],arguments[1],arguments[2])}}()}(),i&&!function(){var t=n.on_added_dom_row;n.on_added_dom_row=function(){e.nbFilterableRows++,e.paging?(e.nbFilterableRows++,e.paging=!1,e.feature("paging").destroy(),e.feature("paging").reset()):e.emitter.emit("rows-changed",e,this),e.alternateRows&&e.feature("alternateRows").init(),t&&t.call(null,arguments[0],arguments[1],arguments[2])},n.actions&&n.actions["delete"]&&!function(){var t=n.actions["delete"].on_after_submit;n.actions["delete"].on_after_submit=function(){e.nbFilterableRows--,e.paging?(e.nbFilterableRows--,e.paging=!1,e.feature("paging").destroy(),e.feature("paging").reset(!1)):e.emitter.emit("rows-changed",e,this),e.alternateRows&&e.feature("alternateRows").init(),t&&t.call(null,arguments[0],arguments[1])}}()}();try{this._ezEditTable=new EditTable(e.id,n,t),this._ezEditTable.Init()}catch(d){throw new Error(c)}this.initialized=!0},t.prototype.reset=function(){var e=this._ezEditTable;e&&(this.cfg.selection&&e.Selection.Set(),this.cfg.editable&&e.Editable.Set())},t.prototype.toggle=function(){var e=this._ezEditTable;e.editable?e.Editable.Remove():e.Editable.Set(),e.selection?e.Selection.Remove():e.Selection.Set()},t.prototype._toggleForInputFilter=function(){var e=this.tf;if(e.getActiveFilterId()){var t=e.getColumnIndexFromFilterId(e.getActiveFilterId()),n=e.getFilterType(t);n===a.INPUT&&this.toggle()}},t.prototype.destroy=function(){var e=this;if(this.initialized){var t=this._ezEditTable;t&&(this.cfg.selection&&(t.Selection.ClearSelections(),t.Selection.Remove()),this.cfg.editable&&t.Editable.Remove()),this.emitter.off(["filter-focus","filter-blur"],function(){return e._toggleForInputFilter()}),this.initialized=!1}},t}(l.Feature);t["default"]=u},32:function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(31),s=o(i);t["default"]=s["default"]},33:function(module,exports,__webpack_require__){"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(exports,"__esModule",{value:!0});var _feature=__webpack_require__(10),_dom=__webpack_require__(3),_types=__webpack_require__(4),ColOps=function(_Feature){function ColOps(e,t){_classCallCheck(this,ColOps);var n=_possibleConstructorReturn(this,_Feature.call(this,e,t.name));return n.onBeforeOperation=(0,_types.isFn)(t.on_before_operation)?t.on_before_operation:null,n.onAfterOperation=(0,_types.isFn)(t.on_after_operation)?t.on_after_operation:null,n.opts=t,n.enable(),n}return _inherits(ColOps,_Feature),ColOps.prototype.init=function(){var e=this;this.initialized||(this.emitter.on(["after-filtering"],function(){return e.calc()}),this.calc(),this.initialized=!0)},ColOps.prototype.calc=function calc(){var tf=this.tf;if(tf.isInitialized()){this.onBeforeOperation&&this.onBeforeOperation.call(null,tf,this),this.emitter.emit("before-column-operation",tf,this);var opts=this.opts,labelId=opts.id,colIndex=opts.col,operation=opts.operation,outputType=opts.write_method,totRowIndex=opts.tot_row_index,excludeRow=opts.exclude_row,decimalPrecision=(0,_types.isUndef)(opts.decimal_precision)?2:opts.decimal_precision,ucolIndex=[],ucolMax=0;ucolIndex[ucolMax]=colIndex[0];for(var ii=1;ii<colIndex.length;ii++){for(var saved=0,jj=0;ucolMax>=jj;jj++)ucolIndex[jj]===colIndex[ii]&&(saved=1);0===saved&&(ucolMax++,ucolIndex[ucolMax]=colIndex[ii])}if((0,_types.isArray)(labelId)&&(0,_types.isArray)(colIndex)&&(0,_types.isArray)(operation))for(var rows=tf.tbl.rows,colvalues=[],ucol=0;ucolMax>=ucol;ucol++){colvalues.push(tf.getColValues(ucolIndex[ucol],!1,!0,excludeRow));for(var result=void 0,nbvalues=0,temp=void 0,meanValue=0,sumValue=0,minValue=null,maxValue=null,q1Value=null,medValue=null,q3Value=null,meanFlag=0,sumFlag=0,minFlag=0,maxFlag=0,q1Flag=0,medFlag=0,q3Flag=0,theList=[],opsThisCol=[],decThisCol=[],labThisCol=[],oTypeThisCol=[],mThisCol=-1,_k=0;_k<colIndex.length;_k++)if(colIndex[_k]===ucolIndex[ucol])switch(mThisCol++,opsThisCol[mThisCol]=operation[_k].toLowerCase(),decThisCol[mThisCol]=decimalPrecision[_k],labThisCol[mThisCol]=labelId[_k],oTypeThisCol=(0,_types.isArray)(outputType)?outputType[_k]:null,opsThisCol[mThisCol]){case"mean":meanFlag=1;break;case"sum":sumFlag=1;break;case"min":minFlag=1;break;case"max":maxFlag=1;break;case"median":medFlag=1;break;case"q1":q1Flag=1;break;case"q3":q3Flag=1}for(var j=0;j<colvalues[ucol].length;j++){if((1===q1Flag||1===q3Flag||1===medFlag)&&j<colvalues[ucol].length-1)for(k=j+1;k<colvalues[ucol].length;k++)eval(colvalues[ucol][k])<eval(colvalues[ucol][j])&&(temp=colvalues[ucol][j],colvalues[ucol][j]=colvalues[ucol][k],colvalues[ucol][k]=temp);var cvalue=parseFloat(colvalues[ucol][j]);theList[j]=parseFloat(cvalue),isNaN(cvalue)||(nbvalues++,1!==sumFlag&&1!==meanFlag||(sumValue+=parseFloat(cvalue)),1===minFlag&&(minValue=null===minValue?parseFloat(cvalue):parseFloat(cvalue)<minValue?parseFloat(cvalue):minValue),1===maxFlag&&(maxValue=null===maxValue?parseFloat(cvalue):parseFloat(cvalue)>maxValue?parseFloat(cvalue):maxValue))}if(1===meanFlag&&(meanValue=sumValue/nbvalues),1===medFlag){var aux=0;nbvalues%2===1?(aux=Math.floor(nbvalues/2),medValue=theList[aux]):medValue=(theList[nbvalues/2]+theList[nbvalues/2-1])/2}var posa=void 0;if(1===q1Flag&&(posa=0,posa=Math.floor(nbvalues/4),q1Value=4*posa===nbvalues?(theList[posa-1]+theList[posa])/2:theList[posa]),1===q3Flag){posa=0;var posb=0;posa=Math.floor(nbvalues/4),4*posa===nbvalues?(posb=3*posa,q3Value=(theList[posb]+theList[posb-1])/2):q3Value=theList[nbvalues-posa-1]}for(var i=0;mThisCol>=i;i++){switch(opsThisCol[i]){case"mean":result=meanValue;break;case"sum":result=sumValue;break;case"min":result=minValue;break;case"max":result=maxValue;break;case"median":result=medValue;break;case"q1":result=q1Value;break;case"q3":result=q3Value}var precision=isNaN(decThisCol[i])?2:decThisCol[i];if(oTypeThisCol&&result){if(result=result.toFixed(precision),(0,_dom.elm)(labThisCol[i]))switch(oTypeThisCol.toLowerCase()){case"innerhtml":isNaN(result)||!isFinite(result)||0===nbvalues?(0,_dom.elm)(labThisCol[i]).innerHTML=".":(0,_dom.elm)(labThisCol[i]).innerHTML=result;break;case"setvalue":(0,_dom.elm)(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=(0,_dom.elm)(labThisCol[i]).firstChild,txtnode=(0,_dom.createText)(result);(0,_dom.elm)(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{isNaN(result)||!isFinite(result)||0===nbvalues?(0,_dom.elm)(labThisCol[i]).innerHTML=".":(0,_dom.elm)(labThisCol[i]).innerHTML=result.toFixed(precision)}catch(e){}}var totRow=totRowIndex&&totRowIndex[ucol]?rows[totRowIndex[ucol]]:null;totRow&&(totRow.style.display="")}this.onAfterOperation&&this.onAfterOperation.call(null,tf,this),this.emitter.emit("after-column-operation",tf,this)}},ColOps.prototype.destroy=function(){var e=this;this.initialized&&(this.emitter.off(["after-filtering"],function(){return e.calc()}),this.initialized=!1)},ColOps}(_feature.Feature);exports["default"]=ColOps},34:function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=n(10),r=n(3),a=n(4),d=n(1),c=function(e){function t(n,s){o(this,t);var l=i(this,e.call(this,n,s.name)),r=l.config;return l.name=s.name,l.desc=s.description||"Columns visibility manager",l.spanEl=null,l.btnEl=null,l.contEl=null,l.tickToHide=s.tick_to_hide!==!1,l.manager=s.manager!==!1,l.headersTbl=s.headers_table||null,l.headersIndex=s.headers_index||1,l.contElTgtId=s.container_target_id||null,l.headersText=s.headers_text||null,l.btnTgtId=s.btn_target_id||null,l.btnText=s.btn_text||"Columns&#9660;",l.btnHtml=s.btn_html||null,l.btnCssClass=s.btn_css_class||"colVis",l.btnCloseText=s.btn_close_text||"Close",l.btnCloseHtml=s.btn_close_html||null,l.btnCloseCssClass=s.btn_close_css_class||l.btnCssClass,l.stylesheet=s.stylesheet||"colsVisibility.css",l.prfx="colVis_",l.spanCssClass=s.span_css_class||"colVisSpan",l.prfxCont=l.prfx+"Cont_",l.contCssClass=s.cont_css_class||"colVisCont",l.listCssClass=r.list_css_class||"cols_checklist",l.listItemCssClass=r.checklist_item_css_class||"cols_checklist_item",l.listSlcItemCssClass=r.checklist_selected_item_css_class||"cols_checklist_slc_item",l.text=s.text||(l.tickToHide?"Hide: ":"Show: "),l.atStart=s.at_start||[],l.enableHover=Boolean(s.enable_hover),l.enableTickAll=Boolean(s.enable_tick_all),l.tickAllText=s.tick_all_text||"Select all:",l.hiddenCols=[],l.onLoaded=(0,a.isFn)(s.on_loaded)?s.on_loaded:null,l.onBeforeOpen=(0,a.isFn)(s.on_before_open)?s.on_before_open:null,l.onAfterOpen=(0,a.isFn)(s.on_after_open)?s.on_after_open:null,l.onBeforeClose=(0,a.isFn)(s.on_before_close)?s.on_before_close:null,l.onAfterClose=(0,a.isFn)(s.on_after_close)?s.on_after_close:null,l.onBeforeColHidden=(0,a.isFn)(s.on_before_col_hidden)?s.on_before_col_hidden:null,l.onAfterColHidden=(0,a.isFn)(s.on_after_col_hidden)?s.on_after_col_hidden:null,l.onBeforeColDisplayed=(0,a.isFn)(s.on_before_col_displayed)?s.on_before_col_displayed:null,l.onAfterColDisplayed=(0,a.isFn)(s.on_after_col_displayed)?s.on_after_col_displayed:null,n.gridLayout&&(l.headersTbl=n.feature("gridLayout").headTbl,l.headersIndex=0,l.onAfterColDisplayed=function(){},l.onAfterColHidden=function(){}),n["import"](s.name+"Style",n.stylePath+l.stylesheet,null,"link"),l.enable(),l}return s(t,e),t.prototype.toggle=function(){var e=this.contEl.style.display,t=this.onBeforeOpen,n=this.onBeforeClose,o=this.onAfterOpen,i=this.onAfterClose;t&&"inline"!==e&&t.call(null,this),n&&"inline"===e&&n.call(null,this),this.contEl.style.display="inline"===e?"none":"inline",o&&"inline"!==e&&o.call(null,this),i&&"inline"===e&&i.call(null,this)},t.prototype.checkItem=function(e){var t=e.parentNode;if(t&&e){var n=e.firstChild.checked,o=e.firstChild.getAttribute("id").split("_")[1];o=parseInt(o,10),n?(0,r.addClass)(t,this.listSlcItemCssClass):(0,r.removeClass)(t,this.listSlcItemCssClass);var i=!1;(this.tickToHide&&n||!this.tickToHide&&!n)&&(i=!0),this.setHidden(o,i)}},t.prototype.init=function(){var e=this;!this.initialized&&this.manager&&(this.emitter.on(["hide-column"],function(t,n){return e.hideCol(n)}),this.buildBtn(),this.buildManager(),this.initialized=!0,this.emitter.emit("columns-visibility-initialized",this.tf,this),this._hideAtStart())},t.prototype.buildBtn=function(){var e=this;if(!this.btnEl){var t=this.tf,n=(0,r.createElm)("span",["id",this.prfx+t.id]);n.className=this.spanCssClass,this.btnTgtId||t.setToolbar();var o=this.btnTgtId?(0,r.elm)(this.btnTgtId):t.rDiv;if(this.btnTgtId)o.appendChild(n);else{var i=o.firstChild;i.parentNode.insertBefore(n,i)}if(this.btnHtml){n.innerHTML=this.btnHtml;var s=n.firstChild;this.enableHover?(0,d.addEvt)(s,"mouseover",function(t){return e.toggle(t)}):(0,d.addEvt)(s,"click",function(t){return e.toggle(t)})}else{var l=(0,r.createElm)("a",["href","javascript:;"]);l.className=this.btnCssClass,l.title=this.desc,l.innerHTML=this.btnText,n.appendChild(l),this.enableHover?(0,d.addEvt)(l,"mouseover",function(t){return e.toggle(t)}):(0,d.addEvt)(l,"click",function(t){return e.toggle(t)})}this.spanEl=n,this.btnEl=this.spanEl.firstChild,this.onLoaded&&this.onLoaded.call(null,this)}},t.prototype.buildManager=function(){var e=this,t=this.tf,n=this.contElTgtId?(0,r.elm)(this.contElTgtId):(0,r.createElm)("div",["id",this.prfxCont+t.id]);n.className=this.contCssClass;var o=(0,r.createElm)("p");o.innerHTML=this.text,n.appendChild(o);var i=(0,r.createElm)("ul",["id","ul"+this.name+"_"+t.id]);i.className=this.listCssClass;var s=this.headersTbl?this.headersTbl:t.tbl,l=this.headersTbl?this.headersIndex:t.getHeadersRowIndex(),a=s.rows[l];this.enableTickAll&&!function(){var n=(0,r.createCheckItem)("col__"+t.id,e.tickAllText,e.tickAllText);(0,r.addClass)(n,e.listItemCssClass),i.appendChild(n),n.check.checked=!e.tickToHide,(0,d.addEvt)(n.check,"click",function(){for(var e=0;e<a.cells.length;e++){var o=(0,r.elm)("col_"+e+"_"+t.id);o&&n.check.checked!==o.checked&&(o.click(),o.checked=n.check.checked)}})}();for(var c=0;c<a.cells.length;c++){var u=a.cells[c],h=this.headersText&&this.headersText[c]?this.headersText[c]:this._getHeaderText(u),p=(0,r.createCheckItem)("col_"+c+"_"+t.id,h,h);(0,r.addClass)(p,this.listItemCssClass),this.tickToHide||(0,r.addClass)(p,this.listSlcItemCssClass),i.appendChild(p),this.tickToHide||(p.check.checked=!0),(0,d.addEvt)(p.check,"click",function(t){var n=(0,d.targetEvt)(t),o=n.parentNode;e.checkItem(o)})}var f=(0,r.createElm)("p",["align","center"]),b=void 0;this.btnCloseHtml?(f.innerHTML=this.btnCloseHtml,b=f.firstChild,(0,d.addEvt)(b,"click",function(t){return e.toggle(t)})):(b=(0,r.createElm)("a",["href","javascript:;"]),b.className=this.btnCloseCssClass,b.innerHTML=this.btnCloseText,(0,d.addEvt)(b,"click",function(t){return e.toggle(t)}),f.appendChild(b)),n.appendChild(i),n.appendChild(f),this.btnEl.parentNode.insertBefore(n,this.btnEl),this.contEl=n},t.prototype.setHidden=function(e,t){var n=this.tf,o=n.tbl;this.onBeforeColHidden&&t&&this.onBeforeColHidden.call(null,this,e),this.onBeforeColDisplayed&&!t&&this.onBeforeColDisplayed.call(null,this,e),this._hideCells(o,e,t),this.headersTbl&&this._hideCells(this.headersTbl,e,t);var i=this.hiddenCols,s=i.indexOf(e);t?-1===s&&this.hiddenCols.push(e):-1!==s&&this.hiddenCols.splice(s,1);var l=void 0,r=void 0,a=void 0;if(t){if(n.gridLayout){l=n.feature("gridLayout"),r=l.headTbl,a=l.colElms;var d=parseInt(a[e].style.width,10),c=parseInt(r.style.width,10);r.style.width=c-d+"px",o.style.width=r.style.width}this.onAfterColHidden&&this.onAfterColHidden.call(null,this,e),this.emitter.emit("column-hidden",n,this,e,this.hiddenCols)}if(!t){if(n.gridLayout){l=n.feature("gridLayout"),r=l.headTbl,a=l.colElms;var u=parseInt(a[e].style.width,10);r.style.width=parseInt(r.style.width,10)+u+"px",n.tbl.style.width=r.style.width}this.onAfterColDisplayed&&this.onAfterColDisplayed.call(null,this,e),this.emitter.emit("column-shown",n,this,e,this.hiddenCols)}},t.prototype.showCol=function(e){if(void 0!==e&&this.isColHidden(e))if(this.manager&&this.contEl){var t=(0,r.elm)("col_"+e+"_"+this.tf.id);t&&t.click()}else this.setHidden(e,!1)},t.prototype.hideCol=function(e){if(void 0!==e&&!this.isColHidden(e))if(this.manager&&this.contEl){var t=(0,r.elm)("col_"+e+"_"+this.tf.id);t&&t.click()}else this.setHidden(e,!0)},t.prototype.isColHidden=function(e){return-1!==this.hiddenCols.indexOf(e)},t.prototype.toggleCol=function(e){void 0===e||this.isColHidden(e)?this.showCol(e):this.hideCol(e)},t.prototype.getHiddenCols=function(){return this.hiddenCols},t.prototype.destroy=function(){var e=this;this.initialized&&((0,r.elm)(this.contElTgtId)?(0,r.elm)(this.contElTgtId).innerHTML="":(this.contEl.innerHTML="",(0,r.removeElm)(this.contEl),this.contEl=null),this.btnEl.innerHTML="",(0,r.removeElm)(this.btnEl),this.btnEl=null,this.emitter.off(["hide-column"],function(t,n){return e.hideCol(n)}),this.initialized=!1)},t.prototype._getHeaderText=function(e){if(!e.hasChildNodes)return"";for(var t=0;t<e.childNodes.length;t++){var n=e.childNodes[t];if(3===n.nodeType)return n.nodeValue;if(1===n.nodeType){if(n.id&&-1!==n.id.indexOf("popUp"))continue;return(0,r.getText)(n)}}return""},t.prototype._hideCells=function(e,t,n){for(var o=0;o<e.rows.length;o++){var i=e.rows[o],s=i.cells[t];s&&(s.style.display=n?"none":"")}},t.prototype._hideAtStart=function(){var e=this;this.atStart.forEach(function(t){e.hideCol(t)})},t}(l.Feature);t["default"]=c},35:function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=n(10),r=n(3),a=n(4),d=n(1),c=function(e){function t(n,s){o(this,t);var l=i(this,e.call(this,n,s.name));return l.name=s.name,l.desc=s.description||"Filters row visibility manager",l.stylesheet=s.stylesheet||"filtersVisibility.css",l.icnExpand=s.expand_icon_name||"icn_exp.png",l.icnCollapse=s.collapse_icon_name||"icn_clp.png",l.contEl=null,l.btnEl=null,l.icnExpandHtml='<img src="'+n.themesPath+l.icnExpand+'" alt="Expand filters" >',l.icnCollapseHtml='<img src="'+n.themesPath+l.icnCollapse+'" alt="Collapse filters" >',l.defaultText="Toggle filters",l.targetId=s.target_id||null,l.enableIcon=s.enable_icon!==!1,l.btnText=s.btn_text||"",l.collapseBtnHtml=l.enableIcon?l.icnCollapseHtml+l.btnText:l.btnText||l.defaultText,l.expandBtnHtml=l.enableIcon?l.icnExpandHtml+l.btnText:l.btnText||l.defaultText,l.btnHtml=s.btn_html||null,l.btnCssClass=s.btn_css_class||"btnExpClpFlt",l.contCssClass=s.cont_css_class||"expClpFlt",l.filtersRowIndex=(0,a.isUndef)(s.filters_row_index)?n.getFiltersRowIndex():s.filters_row_index,l.visibleAtStart=(0,a.isUndef)(s.visible_at_start)?!0:Boolean(s.visible_at_start),l.prfx="fltsVis_",l.onBeforeShow=(0,a.isFn)(s.on_before_show)?s.on_before_show:null,l.onAfterShow=(0,a.isFn)(s.on_after_show)?s.on_after_show:null,l.onBeforeHide=(0,a.isFn)(s.on_before_hide)?s.on_before_hide:null,l.onAfterHide=(0,a.isFn)(s.on_after_hide)?s.on_after_hide:null,n["import"](s.name+"Style",n.stylePath+l.stylesheet,null,"link"),l.enable(),l}return s(t,e),t.prototype.init=function(){var e=this;this.initialized||(this.buildUI(),this.initialized=!0,this.emitter.on(["show-filters"],function(t,n){return e.show(n)}),this.emitter.emit("filters-visibility-initialized",this.tf,this))},t.prototype.buildUI=function(){var e=this,t=this.tf,n=(0,r.createElm)("span",["id",this.prfx+t.id]);n.className=this.contCssClass,this.targetId||t.setToolbar();var o=this.targetId?(0,r.elm)(this.targetId):t.rDiv;if(this.targetId)o.appendChild(n);else{var i=o.firstChild;i.parentNode.insertBefore(n,i)}var s=void 0;this.btnHtml?(n.innerHTML=this.btnHtml,s=n.firstChild):(s=(0,r.createElm)("a",["href","javascript:void(0);"]),s.className=this.btnCssClass,s.title=this.btnText||this.defaultText,s.innerHTML=this.collapseBtnHtml,n.appendChild(s)),(0,d.addEvt)(s,"click",function(){return e.toggle()}),this.contEl=n,this.btnEl=s,this.visibleAtStart||this.toggle()},t.prototype.toggle=function(){var e=this.tf,t=e.gridLayout?e.feature("gridLayout").headTbl:e.tbl,n=t.rows[this.filtersRowIndex],o=""===n.style.display;this.show(!o)},t.prototype.show=function(){var e=arguments.length<=0||void 0===arguments[0]?!0:arguments[0],t=this.tf,n=t.gridLayout?t.feature("gridLayout").headTbl:t.tbl,o=n.rows[this.filtersRowIndex];this.onBeforeShow&&e&&this.onBeforeShow.call(this,this),this.onBeforeHide&&!e&&this.onBeforeHide.call(null,this),o.style.display=e?"":"none",this.enableIcon&&!this.btnHtml&&(this.btnEl.innerHTML=e?this.collapseBtnHtml:this.expandBtnHtml),this.onAfterShow&&e&&this.onAfterShow.call(null,this),this.onAfterHide&&!e&&this.onAfterHide.call(null,this),this.emitter.emit("filters-toggled",t,this,e)},t.prototype.destroy=function(){var e=this;this.initialized&&(this.emitter.off(["show-filters"],function(t,n){return e.show(n)}),this.btnEl.innerHTML="",(0,r.removeElm)(this.btnEl),this.btnEl=null,this.contEl.innerHTML="",(0,r.removeElm)(this.contEl),this.contEl=null,this.initialized=!1)},t}(l.Feature);t["default"]=c},36:function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(e){return(0,_.removeNbFormat)(e,"us")}function r(e){return(0,_.removeNbFormat)(e,"eu")}function a(e,t){return(0,v.formatDate)(e,t)}function d(e){return a(e,"DMY")}function c(e){return a(e,"MDY")}function u(e){return a(e,"YMD")}function h(e){return a(e,"DDMMMYYYY")}function p(e){var t=e.split(".");for(var n in t){for(var o=t[n];3>o.length;)o="0"+o;t[n]=o}return t.join(".")}function f(e,t){var n=p(e.value.toLowerCase()),o=p(t.value.toLowerCase());return n===o?0:o>n?-1:1}Object.defineProperty(t,"__esModule",{value:!0});var b=n(10),m=n(4),y=n(3),g=n(1),v=n(6),_=n(7),T=n(11),C=function(e){function t(n,s){o(this,t);var l=i(this,e.call(this,n,s.name));return l.name=s.name,l.desc=s.description||"Sortable table",l.sorted=!1,l.sortTypes=(0,m.isArray)(s.types)?s.types:[],l.sortColAtStart=(0,m.isArray)(s.sort_col_at_start)?s.sort_col_at_start:null,l.asyncSort=Boolean(s.async_sort),l.triggerIds=(0,m.isArray)(s.trigger_ids)?s.trigger_ids:[],l.imgPath=s.images_path||n.themesPath,l.imgBlank=s.image_blank||"blank.png",l.imgClassName=s.image_class_name||"sort-arrow",l.imgAscClassName=s.image_asc_class_name||"ascending",l.imgDescClassName=s.image_desc_class_name||"descending",l.customKey=s.custom_key||"data-tf-sortKey",l.onSortLoaded=(0,m.isFn)(s.on_sort_loaded)?s.on_sort_loaded:null,l.onBeforeSort=(0,m.isFn)(s.on_before_sort)?s.on_before_sort:null,l.onAfterSort=(0,m.isFn)(s.on_after_sort)?s.on_after_sort:null,l.stt=null,l.enable(),l}return s(t,e),t.prototype.init=function(){var e=this;if(!this.initialized){var t=this.tf,n=this;if((0,m.isUndef)(SortableTable))throw new Error("SortableTable class not found.");this.overrideSortableTable(),this.setSortTypes();var o=n.sortColAtStart;o&&this.stt.sort(o[0],o[1]),this.onSortLoaded&&this.onSortLoaded.call(null,t,this),this.stt.onbeforesort=function(){n.onBeforeSort&&n.onBeforeSort.call(null,t,n.stt.sortColumn),t.paging&&t.feature("paging").disable()},this.stt.onsort=function(){if(n.sorted=!0,t.paging){var e=t.feature("paging");t.getValidRows(!0),e.enable(),e.setPage(e.getPage())}n.onAfterSort&&n.onAfterSort.call(null,t,n.stt.sortColumn,n.stt.descending),n.emitter.emit("column-sorted",t,n.stt.sortColumn,n.stt.descending)},this.emitter.on(["sort"],function(t,n,o){return e.sortByColumnIndex(n,o)}),this.initialized=!0,this.emitter.emit("sort-initialized",t,this)}},t.prototype.sortByColumnIndex=function(e,t){this.stt.sort(e,t)},t.prototype.overrideSortableTable=function(){var e=this,t=this.tf;SortableTable.prototype.headerOnclick=function(t){if(e.initialized){for(var n=t.target||t.srcElement;n.tagName!==T.CELL_TAG&&n.tagName!==T.HEADER_TAG;)n=n.parentNode;this.sort(SortableTable.msie?SortableTable.getCellIndex(n):n.cellIndex)}},SortableTable.getCellIndex=function(e){var t=e.parentNode.cells,n=t.length,o=void 0;for(o=0;t[o]!==e&&n>o;o++);return o},SortableTable.prototype.initHeader=function(n){var o=this;if(!o.tHead){if(!t.gridLayout)return;o.tHead=t.feature("gridLayout").headTbl.tHead}o.headersRow=t.headersRow;var i=o.tHead.rows[o.headersRow].cells;o.sortTypes=n||[];for(var s=i.length,l=void 0,r=void 0,a=0;s>a;a++)r=i[a],null!==o.sortTypes[a]&&"None"!==o.sortTypes[a]?(r.style.cursor="pointer",l=(0,y.createElm)("img",["src",e.imgPath+e.imgBlank]),r.appendChild(l),null!==o.sortTypes[a]&&r.setAttribute("_sortType",o.sortTypes[a]),(0,g.addEvt)(r,"click",o._headerOnclick)):(r.setAttribute("_sortType",n[a]),r._sortType="None");o.updateHeaderArrows()},SortableTable.prototype.updateHeaderArrows=function(){var t=this,n=void 0,o=void 0,i=void 0;if(e.asyncSort&&e.triggerIds.length>0){var s=e.triggerIds;n=[],o=s.length;for(var l=0;o>l;l++)n.push((0,y.elm)(s[l]))}else{if(!this.tHead)return;n=t.tHead.rows[t.headersRow].cells,o=n.length}for(var r=0;o>r;r++){var a=n[r];if(a){var d=a.getAttribute("_sortType");null!==d&&"None"!==d&&(i=a.lastChild||a,"img"!==i.nodeName.toLowerCase()&&(i=(0,y.createElm)("img",["src",e.imgPath+e.imgBlank]),a.appendChild(i)),r===t.sortColumn?i.className=e.imgClassName+" "+(this.descending?e.imgDescClassName:e.imgAscClassName):i.className=e.imgClassName)}}},SortableTable.prototype.getRowValue=function(e,t,n){var o=this,i=o._sortTypeInfo[t];if(i&&i.getRowValue)return i.getRowValue(e,n);var s=e.cells[n],l=SortableTable.getInnerText(s);return o.getValueFromString(l,t);
},SortableTable.getInnerText=function(t){return t?t.getAttribute(e.customKey)?t.getAttribute(e.customKey):(0,y.getText)(t):void 0}},t.prototype.addSortType=function(){var e=arguments;SortableTable.prototype.addSortType(e[0],e[1],e[2],e[3])},t.prototype.setSortTypes=function(){for(var e=this,t=this.tf,n=this.sortTypes,o=[],i=0;i<t.nbCells;i++){var s=void 0;n[i]?(s=n[i].toLowerCase(),s===T.NONE&&(s="None")):s=t.hasColNbFormat&&null!==t.colNbFormat[i]?t.colNbFormat[i].toLowerCase():t.hasColDateType&&null!==t.colDateType[i]?t.colDateType[i].toLowerCase()+"date":"String",o.push(s)}this.addSortType("number",Number),this.addSortType("caseinsensitivestring",SortableTable.toUpperCase),this.addSortType("date",SortableTable.toDate),this.addSortType("string"),this.addSortType("us",l),this.addSortType("eu",r),this.addSortType("dmydate",d),this.addSortType("ymddate",u),this.addSortType("mdydate",c),this.addSortType("ddmmmyyyydate",h),this.addSortType("ipaddress",p,f),this.stt=new SortableTable(t.tbl,o),this.asyncSort&&this.triggerIds.length>0&&!function(){for(var t=e.triggerIds,n=0;n<t.length;n++)if(null!==t[n]){var i=(0,y.elm)(t[n]);i&&(i.style.cursor="pointer",(0,g.addEvt)(i,"click",function(n){var o=n.target;e.tf.sort&&e.stt.asyncSort(t.indexOf(o.id))}),i.setAttribute("_sortType",o[n]))}}()},t.prototype.destroy=function(){var e=this;if(this.initialized){var t=this.tf;this.emitter.off(["sort"],function(t,n,o){return e.sortByColumnIndex(n,o)}),this.sorted=!1,this.initialized=!1,this.stt.destroy();for(var n=t.getFiltersId(),o=0;o<n.length;o++){var i=t.getHeaderElement(o),s=(0,y.tag)(i,"img");1===s.length&&i.removeChild(s[0])}this.initialized=!1}},t}(b.Feature);t["default"]=C},37:function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(36),s=o(i),l=n(2);l.root.SortableTable||n(38),t["default"]=s["default"]},38:function(e,t,n){n(39)(n(40))},39:function(e,t){e.exports=function(e){"undefined"!=typeof execScript?execScript(e):eval.call(null,e)}},40:function(e,t){e.exports='/*----------------------------------------------------------------------------\\\n| Sortable Table 1.12 |\n|-----------------------------------------------------------------------------|\n| Created by Erik Arvidsson |\n| (http://webfx.eae.net/contact.html#erik) |\n| For WebFX (http://webfx.eae.net/) |\n|-----------------------------------------------------------------------------|\n| A DOM 1 based script that allows an ordinary HTML table to be sortable. |\n|-----------------------------------------------------------------------------|\n| Copyright (c) 1998 - 2006 Erik Arvidsson |\n|-----------------------------------------------------------------------------|\n| Licensed under the Apache License, Version 2.0 (the "License"); you may not |\n| use this file except in compliance with the License. You may obtain a copy |\n| of the License at http://www.apache.org/licenses/LICENSE-2.0 |\n| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |\n| Unless required by applicable law or agreed to in writing, software |\n| distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |\n| WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |\n| License for the specific language governing permissions and limitations |\n| under the License. |\n|-----------------------------------------------------------------------------|\n| 2003-01-10 | First version |\n| 2003-01-19 | Minor changes to the date parsing |\n| 2003-01-28 | JScript 5.0 fixes (no support for \'in\' operator) |\n| 2003-02-01 | Sloppy typo like error fixed in getInnerText |\n| 2003-07-04 | Added workaround for IE cellIndex bug. |\n| 2003-11-09 | The bDescending argument to sort was not correctly working |\n| | Using onclick DOM0 event if no support for addEventListener |\n| | or attachEvent |\n| 2004-01-13 | Adding addSortType and removeSortType which makes it a lot |\n| | easier to add new, custom sort types. |\n| 2004-01-27 | Switch to use descending = false as the default sort order. |\n| | Change defaultDescending to suit your needs. |\n| 2004-03-14 | Improved sort type None look and feel a bit |\n| 2004-08-26 | Made the handling of tBody and tHead more flexible. Now you |\n| | can use another tHead or no tHead, and you can chose some |\n| | other tBody. |\n| 2006-04-25 | Changed license to Apache Software License 2.0 |\n|-----------------------------------------------------------------------------|\n| Created 2003-01-10 | All changes are in the log above. | Updated 2006-04-25 |\n\\----------------------------------------------------------------------------*/\n\n\nfunction SortableTable(oTable, oSortTypes) {\n\n this.sortTypes = oSortTypes || [];\n\n this.sortColumn = null;\n this.descending = null;\n\n var oThis = this;\n this._headerOnclick = function (e) {\n oThis.headerOnclick(e);\n };\n\n if (oTable) {\n this.setTable( oTable );\n this.document = oTable.ownerDocument || oTable.document;\n }\n else {\n this.document = document;\n }\n\n\n // only IE needs this\n var win = this.document.defaultView || this.document.parentWindow;\n this._onunload = function () {\n oThis.destroy();\n };\n if (win && typeof win.attachEvent != "undefined") {\n win.attachEvent("onunload", this._onunload);\n }\n}\n\nSortableTable.gecko = navigator.product == "Gecko";\nSortableTable.msie = /msie/i.test(navigator.userAgent);\n// Mozilla is faster when doing the DOM manipulations on\n// an orphaned element. MSIE is not\nSortableTable.removeBeforeSort = SortableTable.gecko;\n\nSortableTable.prototype.onsort = function () {};\n\n// default sort order. true -> descending, false -> ascending\nSortableTable.prototype.defaultDescending = false;\n\n// shared between all instances. This is intentional to allow external files\n// to modify the prototype\nSortableTable.prototype._sortTypeInfo = {};\n\nSortableTable.prototype.setTable = function (oTable) {\n if ( this.tHead )\n this.uninitHeader();\n this.element = oTable;\n this.setTHead( oTable.tHead );\n this.setTBody( oTable.tBodies[0] );\n};\n\nSortableTable.prototype.setTHead = function (oTHead) {\n if (this.tHead && this.tHead != oTHead )\n this.uninitHeader();\n this.tHead = oTHead;\n this.initHeader( this.sortTypes );\n};\n\nSortableTable.prototype.setTBody = function (oTBody) {\n this.tBody = oTBody;\n};\n\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\n if ( this.tHead )\n this.uninitHeader();\n this.sortTypes = oSortTypes || [];\n if ( this.tHead )\n this.initHeader( this.sortTypes );\n};\n\n// adds arrow containers and events\n// also binds sort type to the header cells so that reordering columns does\n// not break the sort types\nSortableTable.prototype.initHeader = function (oSortTypes) {\n if (!this.tHead) return;\n var cells = this.tHead.rows[0].cells;\n var doc = this.tHead.ownerDocument || this.tHead.document;\n this.sortTypes = oSortTypes || [];\n var l = cells.length;\n var img, c;\n for (var i = 0; i < l; i++) {\n c = cells[i];\n if (this.sortTypes[i] != null && this.sortTypes[i] != "None") {\n img = doc.createElement("IMG");\n img.src = "images/blank.png";\n c.appendChild(img);\n if (this.sortTypes[i] != null)\n c._sortType = this.sortTypes[i];\n if (typeof c.addEventListener != "undefined")\n c.addEventListener("click", this._headerOnclick, false);\n else if (typeof c.attachEvent != "undefined")\n c.attachEvent("onclick", this._headerOnclick);\n else\n c.onclick = this._headerOnclick;\n }\n else\n {\n c.setAttribute( "_sortType", oSortTypes[i] );\n c._sortType = "None";\n }\n }\n this.updateHeaderArrows();\n};\n\n// remove arrows and events\nSortableTable.prototype.uninitHeader = function () {\n if (!this.tHead) return;\n var cells = this.tHead.rows[0].cells;\n var l = cells.length;\n var c;\n for (var i = 0; i < l; i++) {\n c = cells[i];\n if (c._sortType != null && c._sortType != "None") {\n c.removeChild(c.lastChild);\n if (typeof c.removeEventListener != "undefined")\n c.removeEventListener("click", this._headerOnclick, false);\n else if (typeof c.detachEvent != "undefined")\n c.detachEvent("onclick", this._headerOnclick);\n c._sortType = null;\n c.removeAttribute( "_sortType" );\n }\n }\n};\n\nSortableTable.prototype.updateHeaderArrows = function () {\n if (!this.tHead) return;\n var cells = this.tHead.rows[0].cells;\n var l = cells.length;\n var img;\n for (var i = 0; i < l; i++) {\n if (cells[i]._sortType != null && cells[i]._sortType != "None") {\n img = cells[i].lastChild;\n if (i == this.sortColumn)\n img.className = "sort-arrow " + (this.descending ? "descending" : "ascending");\n else\n img.className = "sort-arrow";\n }\n }\n};\n\nSortableTable.prototype.headerOnclick = function (e) {\n // find TD element\n var el = e.target || e.srcElement;\n while (el.tagName != "TD")\n el = el.parentNode;\n\n this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\n};\n\n// IE returns wrong cellIndex when columns are hidden\nSortableTable.getCellIndex = function (oTd) {\n var cells = oTd.parentNode.childNodes\n var l = cells.length;\n var i;\n for (i = 0; cells[i] != oTd && i < l; i++)\n ;\n return i;\n};\n\nSortableTable.prototype.getSortType = function (nColumn) {\n return this.sortTypes[nColumn] || "String";\n};\n\n// only nColumn is required\n// if bDescending is left out the old value is taken into account\n// if sSortType is left out the sort type is found from the sortTypes array\n\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\n if (!this.tBody) return;\n if (sSortType == null)\n sSortType = this.getSortType(nColumn);\n\n // exit if None\n if (sSortType == "None")\n return;\n\n if (bDescending == null) {\n if (this.sortColumn != nColumn)\n this.descending = this.defaultDescending;\n else\n this.descending = !this.descending;\n }\n else\n this.descending = bDescending;\n\n this.sortColumn = nColumn;\n\n if (typeof this.onbeforesort == "function")\n this.onbeforesort();\n\n var f = this.getSortFunction(sSortType, nColumn);\n var a = this.getCache(sSortType, nColumn);\n var tBody = this.tBody;\n\n a.sort(f);\n\n if (this.descending)\n a.reverse();\n\n if (SortableTable.removeBeforeSort) {\n // remove from doc\n var nextSibling = tBody.nextSibling;\n var p = tBody.parentNode;\n p.removeChild(tBody);\n }\n\n // insert in the new order\n var l = a.length;\n for (var i = 0; i < l; i++)\n tBody.appendChild(a[i].element);\n\n if (SortableTable.removeBeforeSort) {\n // insert into doc\n p.insertBefore(tBody, nextSibling);\n }\n\n this.updateHeaderArrows();\n\n this.destroyCache(a);\n\n if (typeof this.onsort == "function")\n this.onsort();\n};\n\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\n var oThis = this;\n this._asyncsort = function () {\n oThis.sort(nColumn, bDescending, sSortType);\n };\n window.setTimeout(this._asyncsort, 1);\n};\n\nSortableTable.prototype.getCache = function (sType, nColumn) {\n if (!this.tBody) return [];\n var rows = this.tBody.rows;\n var l = rows.length;\n var a = new Array(l);\n var r;\n for (var i = 0; i < l; i++) {\n r = rows[i];\n a[i] = {\n value: this.getRowValue(r, sType, nColumn),\n element: r\n };\n };\n return a;\n};\n\nSortableTable.prototype.destroyCache = function (oArray) {\n var l = oArray.length;\n for (var i = 0; i < l; i++) {\n oArray[i].value = null;\n oArray[i].element = null;\n oArray[i] = null;\n }\n};\n\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\n // if we have defined a custom getRowValue use that\n if (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\n return this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\n\n var s;\n var c = oRow.cells[nColumn];\n if (typeof c.innerText != "undefined")\n s = c.innerText;\n else\n s = SortableTable.getInnerText(c);\n return this.getValueFromString(s, sType);\n};\n\nSortableTable.getInnerText = function (oNode) {\n var s = "";\n var cs = oNode.childNodes;\n var l = cs.length;\n for (var i = 0; i < l; i++) {\n switch (cs[i].nodeType) {\n case 1: //ELEMENT_NODE\n s += SortableTable.getInnerText(cs[i]);\n break;\n case 3: //TEXT_NODE\n s += cs[i].nodeValue;\n break;\n }\n }\n return s;\n};\n\nSortableTable.prototype.getValueFromString = function (sText, sType) {\n if (this._sortTypeInfo[sType])\n return this._sortTypeInfo[sType].getValueFromString( sText );\n return sText;\n /*\n switch (sType) {\n case "Number":\n return Number(sText);\n case "CaseInsensitiveString":\n return sText.toUpperCase();\n case "Date":\n var parts = sText.split("-");\n var d = new Date(0);\n d.setFullYear(parts[0]);\n d.setDate(parts[2]);\n d.setMonth(parts[1] - 1);\n return d.valueOf();\n }\n return sText;\n */\n };\n\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\n if (this._sortTypeInfo[sType])\n return this._sortTypeInfo[sType].compare;\n return SortableTable.basicCompare;\n};\n\nSortableTable.prototype.destroy = function () {\n this.uninitHeader();\n var win = this.document.parentWindow;\n if (win && typeof win.detachEvent != "undefined") { // only IE needs this\n win.detachEvent("onunload", this._onunload);\n }\n this._onunload = null;\n this.element = null;\n this.tHead = null;\n this.tBody = null;\n this.document = null;\n this._headerOnclick = null;\n this.sortTypes = null;\n this._asyncsort = null;\n this.onsort = null;\n};\n\n// Adds a sort type to all instance of SortableTable\n// sType : String - the identifier of the sort type\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\n// string and casts it to a desired format. If left out the string is just\n// returned\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\n// compare function. Takes two values and compares them. If left out less than,\n// <, compare is used\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\n// that takes the row and the column index and returns the value used to compare.\n// If left out then the innerText is first taken for the cell and then the\n// fGetValueFromString is used to convert that string the desired value and type\n\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\n this._sortTypeInfo[sType] = {\n type: sType,\n getValueFromString: fGetValueFromString || SortableTable.idFunction,\n compare: fCompareFunction || SortableTable.basicCompare,\n getRowValue: fGetRowValue\n };\n};\n\n// this removes the sort type from all instances of SortableTable\nSortableTable.prototype.removeSortType = function (sType) {\n delete this._sortTypeInfo[sType];\n};\n\nSortableTable.basicCompare = function compare(n1, n2) {\n if (n1.value < n2.value)\n return -1;\n if (n2.value < n1.value)\n return 1;\n return 0;\n};\n\nSortableTable.idFunction = function (x) {\n return x;\n};\n\nSortableTable.toUpperCase = function (s) {\n return s.toUpperCase();\n};\n\nSortableTable.toDate = function (s) {\n var parts = s.split("-");\n var d = new Date(0);\n d.setFullYear(parts[0]);\n d.setDate(parts[2]);\n d.setMonth(parts[1] - 1);\n return d.valueOf();\n};\n\n\n// add sort types\nSortableTable.prototype.addSortType("Number", Number);\nSortableTable.prototype.addSortType("CaseInsensitiveString", SortableTable.toUpperCase);\nSortableTable.prototype.addSortType("Date", SortableTable.toDate);\nSortableTable.prototype.addSortType("String");\n// None is a special case\n'}});