1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-05-02 14:52:50 +02:00
TableFilter/dist/tablefilter/tf-1.js

8 lines
48 KiB
JavaScript

/**
* tablefilter v0.4.22 by Max Guglielmi
* build date: 2016-12-17T13:18:32.751Z
* MIT License
*/
webpackJsonp([1],{435:function(t,e,n){function o(t){return n(i(t))}function i(t){return s[t]||function(){throw new Error("Cannot find module '"+t+"'.")}()}var s={"./array":16,"./array.js":16,"./const":11,"./const.js":11,"./cookie":29,"./cookie.js":29,"./dom":3,"./dom.js":3,"./emitter":8,"./emitter.js":8,"./event":1,"./event.js":1,"./extensions/advancedGrid/adapterEzEditTable":436,"./extensions/advancedGrid/adapterEzEditTable.js":436,"./extensions/advancedGrid/advancedGrid":437,"./extensions/advancedGrid/advancedGrid.js":437,"./extensions/colOps/colOps":438,"./extensions/colOps/colOps.js":438,"./extensions/colsVisibility/colsVisibility":439,"./extensions/colsVisibility/colsVisibility.js":439,"./extensions/filtersVisibility/filtersVisibility":440,"./extensions/filtersVisibility/filtersVisibility.js":440,"./extensions/sort/adapterSortabletable":441,"./extensions/sort/adapterSortabletable.js":441,"./extensions/sort/sort":442,"./extensions/sort/sort.js":442,"./feature":10,"./feature.js":10,"./modules/alternateRows":24,"./modules/alternateRows.js":24,"./modules/checkList":18,"./modules/checkList.js":18,"./modules/clearButton":22,"./modules/clearButton.js":22,"./modules/dateType":30,"./modules/dateType.js":30,"./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,"./number":7,"./number.js":7,"./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,t.exports=o,o.id=435},436:function(t,e,n){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(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 s(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});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(t){function e(n,s){o(this,e);var l=i(this,t.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&&n.gridLayout,l._ezEditTable=null,l.cfg=s,l.enable(),l}return s(e,t),e.prototype.init=function(){var t=this;if(!this.initialized){var e=this.tf;if(d.root.EditTable)this._setAdvancedGrid();else{var n=this.vendorPath+this.filename;e.import(this.filename,n,function(){return t._setAdvancedGrid()})}this.loadStylesheet&&!e.isImported(this.stylesheet,"link")&&e.import(this.stylesheetName,this.stylesheet,null,"link"),this.emitter.on(["filter-focus","filter-blur"],function(){return t._toggleForInputFilter()}),this.initialized=!0}},e.prototype._setAdvancedGrid=function(){var t=this.tf,e=void 0,n=this.cfg,o=(0,r.tag)(t.tbl,"thead");e=o.length>0&&!n.startRow?void 0:n.startRow||t.refRow,n.base_path=n.base_path||t.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 e=function(e,n,o){var i=e.Selection,s=function(o){if("row"===e.defaultSelection)i.SelectRowByIndex(o);else{e.ClearSelections();var s=n.cellIndex,l=t.tbl.rows[o];"both"===e.defaultSelection&&i.SelectRowByIndex(o),l&&i.SelectCell(l.cells[s])}if(t.validRowsIndex.length!==t.getRowsNb()){var r=t.tbl.rows[o];r&&r.scrollIntoView(!1),u&&(u.cellIndex===t.getCellsNb()-1&&t.gridLayout?t.tblCont.scrollLeft=1e8:0===u.cellIndex&&t.gridLayout?t.tblCont.scrollLeft=0:u.scrollIntoView(!1))}};if(t.validRowsIndex){var r=t.validRowsIndex,d=r.length,c="row"!==e.defaultSelection?n.parentNode:n,u="TD"===n.nodeName?n:null,h=void 0!==o?e.Event.GetKey(o):0,p=r.indexOf(c.rowIndex)!==-1,f=void 0,b=t.feature("paging"),m=34===h||33===h?b&&b.pagingLength||e.nbRowsPerPage:1;if(p)34!==h&&33!==h?(l=r.indexOf(c.rowIndex),a=c.rowIndex):(f=34===h?l+m<=d-1?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(e,n){var o="row"!==e.defaultSelection?n.parentNode:n;if(t.paging&&t.feature("paging").nbPages>1){var i=t.feature("paging");e.nbRowsPerPage=i.pagingLength;var s=t.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")}};t.paging&&(t.feature("paging").onAfterChangePage=function(t){var e=t.tf.extension("advancedGrid"),n=e._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 t=n.on_before_selected_row;n.on_before_selected_row=function(){o(arguments[0],arguments[1],arguments[2]),t&&t.call(null,arguments[0],arguments[1],arguments[2])};var i=n.on_after_selected_row;n.on_after_selected_row=function(){e(arguments[0],arguments[1],arguments[2]),i&&i.call(null,arguments[0],arguments[1],arguments[2])}}():!function(){var t=n.on_before_selected_cell;n.on_before_selected_cell=function(){o(arguments[0],arguments[1],arguments[2]),t&&t.call(null,arguments[0],arguments[1],arguments[2])};var i=n.on_after_selected_cell;n.on_after_selected_cell=function(){e(arguments[0],arguments[1],arguments[2]),i&&i.call(null,arguments[0],arguments[1],arguments[2])}}()}(),i&&!function(){var e=n.on_added_dom_row;n.on_added_dom_row=function(){t.nbFilterableRows++,t.paging?(t.nbFilterableRows++,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset()):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),e&&e.call(null,arguments[0],arguments[1],arguments[2])},n.actions&&n.actions.delete&&!function(){var e=n.actions.delete.on_after_submit;n.actions.delete.on_after_submit=function(){t.nbFilterableRows--,t.paging?(t.nbFilterableRows--,t.paging=!1,t.feature("paging").destroy(),t.feature("paging").reset(!1)):t.emitter.emit("rows-changed",t,this),t.alternateRows&&t.feature("alternateRows").init(),e&&e.call(null,arguments[0],arguments[1])}}()}();try{this._ezEditTable=new EditTable(t.id,n,e),this._ezEditTable.Init()}catch(t){throw new Error(c)}this.initialized=!0},e.prototype.reset=function(){var t=this._ezEditTable;t&&(this.cfg.selection&&t.Selection.Set(),this.cfg.editable&&t.Editable.Set())},e.prototype.toggle=function(){var t=this._ezEditTable;t.editable?t.Editable.Remove():t.Editable.Set(),t.selection?t.Selection.Remove():t.Selection.Set()},e.prototype._toggleForInputFilter=function(){var t=this.tf;if(t.getActiveFilterId()){var e=t.getColumnIndexFromFilterId(t.getActiveFilterId()),n=t.getFilterType(e);n===a.INPUT&&this.toggle()}},e.prototype.destroy=function(){var t=this;if(this.initialized){var e=this._ezEditTable;e&&(this.cfg.selection&&(e.Selection.ClearSelections(),e.Selection.Remove()),this.cfg.editable&&e.Editable.Remove()),this.emitter.off(["filter-focus","filter-blur"],function(){return t._toggleForInputFilter()}),this.initialized=!1}},e}(l.Feature);e.default=u},437:function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(436),s=o(i);e.default=s.default},438:function(module,exports,__webpack_require__){"use strict";function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(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 _inherits(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(exports,"__esModule",{value:!0});var _feature=__webpack_require__(10),_dom=__webpack_require__(3),_types=__webpack_require__(4),EVENTS=["after-filtering","after-page-change","after-page-length-change"],ColOps=function(_Feature){function ColOps(t,e){_classCallCheck(this,ColOps);var n=_possibleConstructorReturn(this,_Feature.call(this,t,e.name));return n.onBeforeOperation=(0,_types.isFn)(e.on_before_operation)?e.on_before_operation:null,n.onAfterOperation=(0,_types.isFn)(e.on_after_operation)?e.on_after_operation:null,n.opts=e,n.enable(),n}return _inherits(ColOps,_Feature),ColOps.prototype.init=function(){var t=this;this.initialized||(this.emitter.on(EVENTS,function(){return t.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;jj<=ucolMax;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;ucol<=ucolMax;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,j=0,i=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(;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(;i<=mThisCol;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(t){}}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 t=this;this.initialized&&(this.emitter.off(EVENTS,function(){return t.calc()}),this.initialized=!1)},ColOps}(_feature.Feature);exports.default=ColOps},439:function(t,e,n){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(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 s(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});var l=n(10),r=n(3),a=n(4),d=n(1),c=function(t){function e(n,s){o(this,e);var l=i(this,t.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.spanCssClass=s.span_css_class||"colVisSpan",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(e,t),e.prototype.toggle=function(){var t=this.contEl.style.display,e=this.onBeforeOpen,n=this.onBeforeClose,o=this.onAfterOpen,i=this.onAfterClose;e&&"inline"!==t&&e.call(null,this),n&&"inline"===t&&n.call(null,this),this.contEl.style.display="inline"===t?"none":"inline",o&&"inline"!==t&&o.call(null,this),i&&"inline"===t&&i.call(null,this)},e.prototype.checkItem=function(t){var e=t.parentNode;if(e&&t){var n=t.firstChild.checked,o=t.firstChild.getAttribute("id").split("_")[1];o=parseInt(o,10),n?(0,r.addClass)(e,this.listSlcItemCssClass):(0,r.removeClass)(e,this.listSlcItemCssClass);var i=!1;(this.tickToHide&&n||!this.tickToHide&&!n)&&(i=!0),this.setHidden(o,i)}},e.prototype.init=function(){var t=this;!this.initialized&&this.manager&&(this.emitter.on(["hide-column"],function(e,n){return t.hideCol(n)}),this.buildBtn(),this.buildManager(),this.initialized=!0,this.emitter.emit("columns-visibility-initialized",this.tf,this),this._hideAtStart())},e.prototype.buildBtn=function(){var t=this;if(!this.btnEl){var e=this.tf,n=(0,r.createElm)("span");n.className=this.spanCssClass,this.btnTgtId||e.setToolbar();var o=this.btnTgtId?(0,r.elm)(this.btnTgtId):e.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(e){return t.toggle(e)}):(0,d.addEvt)(s,"click",function(e){return t.toggle(e)})}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(e){return t.toggle(e)}):(0,d.addEvt)(l,"click",function(e){return t.toggle(e)})}this.spanEl=n,this.btnEl=this.spanEl.firstChild,this.onLoaded&&this.onLoaded.call(null,this)}},e.prototype.buildManager=function(){var t=this,e=this.tf,n=this.contElTgtId?(0,r.elm)(this.contElTgtId):(0,r.createElm)("div");n.className=this.contCssClass;var o=(0,r.createElm)("p");o.innerHTML=this.text,n.appendChild(o);var i=(0,r.createElm)("ul");i.className=this.listCssClass;var s=this.headersTbl?this.headersTbl:e.tbl,l=this.headersTbl?this.headersIndex:e.getHeadersRowIndex(),a=s.rows[l];this.enableTickAll&&!function(){var n=(0,r.createCheckItem)("col__"+e.id,t.tickAllText,t.tickAllText);(0,r.addClass)(n,t.listItemCssClass),i.appendChild(n),n.check.checked=!t.tickToHide,(0,d.addEvt)(n.check,"click",function(){for(var t=0;t<a.cells.length;t++){var o=(0,r.elm)("col_"+t+"_"+e.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+"_"+e.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(e){var n=(0,d.targetEvt)(e),o=n.parentNode;t.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(e){return t.toggle(e)})):(b=(0,r.createElm)("a",["href","javascript:;"]),b.className=this.btnCloseCssClass,b.innerHTML=this.btnCloseText,(0,d.addEvt)(b,"click",function(e){return t.toggle(e)}),f.appendChild(b)),n.appendChild(i),n.appendChild(f),this.btnEl.parentNode.insertBefore(n,this.btnEl),this.contEl=n},e.prototype.setHidden=function(t,e){var n=this.tf,o=n.tbl;this.onBeforeColHidden&&e&&this.onBeforeColHidden.call(null,this,t),this.onBeforeColDisplayed&&!e&&this.onBeforeColDisplayed.call(null,this,t),this._hideCells(o,t,e),this.headersTbl&&this._hideCells(this.headersTbl,t,e);var i=this.hiddenCols,s=i.indexOf(t);e?s===-1&&this.hiddenCols.push(t):s!==-1&&this.hiddenCols.splice(s,1);var l=void 0,r=void 0,a=void 0;if(e){if(n.gridLayout){l=n.feature("gridLayout"),r=l.headTbl,a=l.colElms;var d=parseInt(a[t].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,t),this.emitter.emit("column-hidden",n,this,t,this.hiddenCols)}if(!e){if(n.gridLayout){l=n.feature("gridLayout"),r=l.headTbl,a=l.colElms;var u=parseInt(a[t].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,t),this.emitter.emit("column-shown",n,this,t,this.hiddenCols)}},e.prototype.showCol=function(t){if(void 0!==t&&this.isColHidden(t))if(this.manager&&this.contEl){var e=(0,r.elm)("col_"+t+"_"+this.tf.id);e&&e.click()}else this.setHidden(t,!1)},e.prototype.hideCol=function(t){if(void 0!==t&&!this.isColHidden(t))if(this.manager&&this.contEl){var e=(0,r.elm)("col_"+t+"_"+this.tf.id);e&&e.click()}else this.setHidden(t,!0)},e.prototype.isColHidden=function(t){return this.hiddenCols.indexOf(t)!==-1},e.prototype.toggleCol=function(t){void 0===t||this.isColHidden(t)?this.showCol(t):this.hideCol(t)},e.prototype.getHiddenCols=function(){return this.hiddenCols},e.prototype.destroy=function(){var t=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(e,n){return t.hideCol(n)}),this.initialized=!1)},e.prototype._getHeaderText=function(t){if(!t.hasChildNodes)return"";for(var e=0;e<t.childNodes.length;e++){var n=t.childNodes[e];if(3===n.nodeType)return n.nodeValue;if(1===n.nodeType){if(n.id&&n.id.indexOf("popUp")!==-1)continue;return(0,r.getText)(n)}}return""},e.prototype._hideCells=function(t,e,n){for(var o=0;o<t.rows.length;o++){var i=t.rows[o],s=i.cells[e];s&&(s.style.display=n?"none":"")}},e.prototype._hideAtStart=function(){var t=this;this.atStart.forEach(function(e){t.hideCol(e)})},e}(l.Feature);e.default=c},440:function(t,e,n){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(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 s(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});var l=n(10),r=n(3),a=n(4),d=n(1),c=function(t){function e(n,s){o(this,e);var l=i(this,t.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)||Boolean(s.visible_at_start),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(e,t),e.prototype.init=function(){var t=this;this.initialized||(this.buildUI(),this.initialized=!0,this.emitter.on(["show-filters"],function(e,n){return t.show(n)}),this.emitter.emit("filters-visibility-initialized",this.tf,this))},e.prototype.buildUI=function(){var t=this,e=this.tf,n=(0,r.createElm)("span");n.className=this.contCssClass,this.targetId||e.setToolbar();var o=this.targetId?(0,r.elm)(this.targetId):e.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 t.toggle()}),this.contEl=n,this.btnEl=s,this.visibleAtStart||this.toggle()},e.prototype.toggle=function(){var t=this.tf,e=t.gridLayout?t.feature("gridLayout").headTbl:t.tbl,n=e.rows[this.filtersRowIndex],o=""===n.style.display;this.show(!o)},e.prototype.show=function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=this.tf,n=e.gridLayout?e.feature("gridLayout").headTbl:e.tbl,o=n.rows[this.filtersRowIndex];this.onBeforeShow&&t&&this.onBeforeShow.call(this,this),this.onBeforeHide&&!t&&this.onBeforeHide.call(null,this),o.style.display=t?"":"none",this.enableIcon&&!this.btnHtml&&(this.btnEl.innerHTML=t?this.collapseBtnHtml:this.expandBtnHtml),this.onAfterShow&&t&&this.onAfterShow.call(null,this),this.onAfterHide&&!t&&this.onAfterHide.call(null,this),this.emitter.emit("filters-toggled",e,this,t)},e.prototype.destroy=function(){var t=this;this.initialized&&(this.emitter.off(["show-filters"],function(e,n){return t.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)},e}(l.Feature);e.default=c},441:function(t,e,n){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(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 s(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)}function l(t){var e=t.split(".");for(var n in e){for(var o=e[n];3>o.length;)o="0"+o;e[n]=o}return e.join(".")}function r(t,e){var n=l(t.value.toLowerCase()),o=l(e.value.toLowerCase());return n===o?0:n<o?-1:1}Object.defineProperty(e,"__esModule",{value:!0});var a=n(10),d=n(4),c=n(3),u=n(1),h=n(7),p=n(11),f=function(t){function e(n,s){o(this,e);var l=i(this,t.call(this,n,s.name));return l.name=s.name,l.desc=s.description||"Sortable table",l.sorted=!1,l.sortTypes=(0,d.isArray)(s.types)?s.types:n.colTypes,l.sortColAtStart=(0,d.isArray)(s.sort_col_at_start)?s.sort_col_at_start:null,l.asyncSort=Boolean(s.async_sort),l.triggerIds=(0,d.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,d.isFn)(s.on_sort_loaded)?s.on_sort_loaded:null,l.onBeforeSort=(0,d.isFn)(s.on_before_sort)?s.on_before_sort:null,l.onAfterSort=(0,d.isFn)(s.on_after_sort)?s.on_after_sort:null,l.stt=null,l.enable(),l}return s(e,t),e.prototype.init=function(){var t=this;if(!this.initialized){var e=this.tf,n=this;if((0,d.isUndef)(SortableTable))throw new Error("SortableTable class not found.");this.emitter.emit("add-date-type-formats",this.tf,this.sortTypes),this.overrideSortableTable(),this.setSortTypes(),this.onSortLoaded&&this.onSortLoaded.call(null,e,this),this.stt.onbeforesort=function(){n.onBeforeSort&&n.onBeforeSort.call(null,e,n.stt.sortColumn),e.paging&&e.feature("paging").disable()},this.stt.onsort=function(){if(n.sorted=!0,e.paging){var t=e.feature("paging");e.getValidRows(!0),t.enable(),t.setPage(t.getPage())}n.onAfterSort&&n.onAfterSort.call(null,e,n.stt.sortColumn,n.stt.descending),n.emitter.emit("column-sorted",e,n.stt.sortColumn,n.stt.descending)};var o=n.sortColAtStart;o&&this.stt.sort(o[0],o[1]),this.emitter.on(["sort"],function(e,n,o){return t.sortByColumnIndex(n,o)}),this.initialized=!0,this.emitter.emit("sort-initialized",e,this)}},e.prototype.sortByColumnIndex=function(t,e){this.stt.sort(t,e)},e.prototype.overrideSortableTable=function(){var t=this,e=this.tf;SortableTable.prototype.headerOnclick=function(e){if(t.initialized){for(var n=e.target||e.srcElement;n.tagName!==p.CELL_TAG&&n.tagName!==p.HEADER_TAG;)n=n.parentNode;this.sort(SortableTable.msie?SortableTable.getCellIndex(n):n.cellIndex)}},SortableTable.getCellIndex=function(t){var e=t.parentNode.cells,n=e.length,o=void 0;for(o=0;e[o]!==t&&o<n;o++);return o},SortableTable.prototype.initHeader=function(n){var o=this;if(!o.tHead){if(!e.gridLayout)return;o.tHead=e.feature("gridLayout").headTbl.tHead}o.headersRow=e.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;a<s;a++)r=i[a],null!==o.sortTypes[a]&&"None"!==o.sortTypes[a]?(r.style.cursor="pointer",l=(0,c.createElm)("img",["src",t.imgPath+t.imgBlank]),r.appendChild(l),null!==o.sortTypes[a]&&r.setAttribute("_sortType",o.sortTypes[a]),(0,u.addEvt)(r,"click",o._headerOnclick)):(r.setAttribute("_sortType",n[a]),r._sortType="None");o.updateHeaderArrows()},SortableTable.prototype.updateHeaderArrows=function(){var e=this,n=void 0,o=void 0,i=void 0;if(t.asyncSort&&t.triggerIds.length>0){var s=t.triggerIds;n=[],o=s.length;for(var l=0;l<o;l++)n.push((0,c.elm)(s[l]))}else{if(!this.tHead)return;n=e.tHead.rows[e.headersRow].cells,o=n.length}for(var r=0;r<o;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,c.createElm)("img",["src",t.imgPath+t.imgBlank]),a.appendChild(i)),r===e.sortColumn?i.className=t.imgClassName+" "+(this.descending?t.imgDescClassName:t.imgAscClassName):i.className=t.imgClassName)}}},SortableTable.prototype.getRowValue=function(t,e,n){var o=this,i=o._sortTypeInfo[e];if(i&&i.getRowValue)return i.getRowValue(t,n);var s=t.cells[n],l=SortableTable.getInnerText(s);return o.getValueFromString(l,e)},SortableTable.getInnerText=function(e){if(e)return e.getAttribute(t.customKey)?e.getAttribute(t.customKey):(0,c.getText)(e)}},e.prototype.addSortType=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];var o=e[0],i=e[1],s=e[2];SortableTable.prototype.addSortType(o,i,s)},e.prototype.setSortTypes=function(){
for(var t=this,e=this.tf,n=this.sortTypes,o=[],i=0;i<e.nbCells;i++){var s=void 0;if(n[i])if(s=n[i],(0,d.isObj)(s)){if(s.type===p.DATE)s=this._addDateType(i,n);else if(s.type===p.FORMATTED_NUMBER){var a=s.decimal||e.decimalSeparator;s=this._addNumberType(i,a)}}else s=s.toLowerCase(),s===p.DATE?s=this._addDateType(i,n):s===p.FORMATTED_NUMBER||s===p.NUMBER?s=this._addNumberType(i,e.decimalSeparator):s===p.NONE&&(s="None");else s=p.STRING;o.push(s)}this.addSortType("caseinsensitivestring",SortableTable.toUpperCase),this.addSortType(p.STRING),this.addSortType(p.IP_ADDRESS,l,r),this.stt=new SortableTable(e.tbl,o),this.asyncSort&&this.triggerIds.length>0&&!function(){for(var e=t.triggerIds,n=0;n<e.length;n++)if(null!==e[n]){var i=(0,c.elm)(e[n]);i&&(i.style.cursor="pointer",(0,u.addEvt)(i,"click",function(n){var o=n.target;t.tf.sort&&t.stt.asyncSort(e.indexOf(o.id))}),i.setAttribute("_sortType",o[n]))}}()},e.prototype._addDateType=function(t,e){var n=this.tf,o=n.feature("dateType"),i=o.getOptions(t,e).locale||n.locale,s=p.DATE+"-"+i;return this.addSortType(s,function(t){var e=o.parse(t,i);return isNaN(+e)?new Date(-864e11):e}),s},e.prototype._addNumberType=function(t,e){var n=""+p.FORMATTED_NUMBER+("."===e?"":"-custom");return this.addSortType(n,function(t){return(0,h.parse)(t,e)}),n},e.prototype.destroy=function(){var t=this;if(this.initialized){var e=this.tf;this.emitter.off(["sort"],function(e,n,o){return t.sortByColumnIndex(n,o)}),this.sorted=!1,this.stt.destroy();for(var n=e.getFiltersId(),o=0;o<n.length;o++){var i=e.getHeaderElement(o),s=(0,c.tag)(i,"img");1===s.length&&i.removeChild(s[0])}this.initialized=!1}},e}(a.Feature);e.default=f},442:function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(441),s=o(i),l=n(2);l.root.SortableTable||n(443),e.default=s.default},443:function(t,e,n){n(444)(n(445))},444:function(t,e){t.exports=function(t){"undefined"!=typeof execScript?execScript(t):eval.call(null,t)}},445:function(t,e){t.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\tthis.sortTypes = oSortTypes || [];\n\n\tthis.sortColumn = null;\n\tthis.descending = null;\n\n\tvar oThis = this;\n\tthis._headerOnclick = function (e) {\n\t\toThis.headerOnclick(e);\n\t};\n\n\tif (oTable) {\n\t\tthis.setTable( oTable );\n\t\tthis.document = oTable.ownerDocument || oTable.document;\n\t}\n\telse {\n\t\tthis.document = document;\n\t}\n\n\n\t// only IE needs this\n\tvar win = this.document.defaultView || this.document.parentWindow;\n\tthis._onunload = function () {\n\t\toThis.destroy();\n\t};\n\tif (win && typeof win.attachEvent != "undefined") {\n\t\twin.attachEvent("onunload", this._onunload);\n\t}\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\tif ( this.tHead )\n\t\tthis.uninitHeader();\n\tthis.element = oTable;\n\tthis.setTHead( oTable.tHead );\n\tthis.setTBody( oTable.tBodies[0] );\n};\n\nSortableTable.prototype.setTHead = function (oTHead) {\n\tif (this.tHead && this.tHead != oTHead )\n\t\tthis.uninitHeader();\n\tthis.tHead = oTHead;\n\tthis.initHeader( this.sortTypes );\n};\n\nSortableTable.prototype.setTBody = function (oTBody) {\n\tthis.tBody = oTBody;\n};\n\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\n\tif ( this.tHead )\n\t\tthis.uninitHeader();\n\tthis.sortTypes = oSortTypes || [];\n\tif ( this.tHead )\n\t\tthis.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\tif (!this.tHead) return;\n\tvar cells = this.tHead.rows[0].cells;\n\tvar doc = this.tHead.ownerDocument || this.tHead.document;\n\tthis.sortTypes = oSortTypes || [];\n\tvar l = cells.length;\n\tvar img, c;\n\tfor (var i = 0; i < l; i++) {\n\t\tc = cells[i];\n\t\tif (this.sortTypes[i] != null && this.sortTypes[i] != "None") {\n\t\t\timg = doc.createElement("IMG");\n\t\t\timg.src = "images/blank.png";\n\t\t\tc.appendChild(img);\n\t\t\tif (this.sortTypes[i] != null)\n\t\t\t\tc._sortType = this.sortTypes[i];\n\t\t\tif (typeof c.addEventListener != "undefined")\n\t\t\t\tc.addEventListener("click", this._headerOnclick, false);\n\t\t\telse if (typeof c.attachEvent != "undefined")\n\t\t\t\tc.attachEvent("onclick", this._headerOnclick);\n\t\t\telse\n\t\t\t\tc.onclick = this._headerOnclick;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tc.setAttribute( "_sortType", oSortTypes[i] );\n\t\t\tc._sortType = "None";\n\t\t}\n\t}\n\tthis.updateHeaderArrows();\n};\n\n// remove arrows and events\nSortableTable.prototype.uninitHeader = function () {\n\tif (!this.tHead) return;\n\tvar cells = this.tHead.rows[0].cells;\n\tvar l = cells.length;\n\tvar c;\n\tfor (var i = 0; i < l; i++) {\n\t\tc = cells[i];\n\t\tif (c._sortType != null && c._sortType != "None") {\n\t\t\tc.removeChild(c.lastChild);\n\t\t\tif (typeof c.removeEventListener != "undefined")\n\t\t\t\tc.removeEventListener("click", this._headerOnclick, false);\n\t\t\telse if (typeof c.detachEvent != "undefined")\n\t\t\t\tc.detachEvent("onclick", this._headerOnclick);\n\t\t\tc._sortType = null;\n\t\t\tc.removeAttribute( "_sortType" );\n\t\t}\n\t}\n};\n\nSortableTable.prototype.updateHeaderArrows = function () {\n\tif (!this.tHead) return;\n\tvar cells = this.tHead.rows[0].cells;\n\tvar l = cells.length;\n\tvar img;\n\tfor (var i = 0; i < l; i++) {\n\t\tif (cells[i]._sortType != null && cells[i]._sortType != "None") {\n\t\t\timg = cells[i].lastChild;\n\t\t\tif (i == this.sortColumn)\n\t\t\t\timg.className = "sort-arrow " + (this.descending ? "descending" : "ascending");\n\t\t\telse\n\t\t\t\timg.className = "sort-arrow";\n\t\t}\n\t}\n};\n\nSortableTable.prototype.headerOnclick = function (e) {\n\t// find TD element\n\tvar el = e.target || e.srcElement;\n\twhile (el.tagName != "TD")\n\t\tel = el.parentNode;\n\n\tthis.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\n};\n\n// IE returns wrong cellIndex when columns are hidden\nSortableTable.getCellIndex = function (oTd) {\n\tvar cells = oTd.parentNode.childNodes\n\tvar l = cells.length;\n\tvar i;\n\tfor (i = 0; cells[i] != oTd && i < l; i++)\n\t\t;\n\treturn i;\n};\n\nSortableTable.prototype.getSortType = function (nColumn) {\n\treturn 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\tif (!this.tBody) return;\n\tif (sSortType == null)\n\t\tsSortType = this.getSortType(nColumn);\n\n\t// exit if None\n\tif (sSortType == "None")\n\t\treturn;\n\n\tif (bDescending == null) {\n\t\tif (this.sortColumn != nColumn)\n\t\t\tthis.descending = this.defaultDescending;\n\t\telse\n\t\t\tthis.descending = !this.descending;\n\t}\n\telse\n\t\tthis.descending = bDescending;\n\n\tthis.sortColumn = nColumn;\n\n\tif (typeof this.onbeforesort == "function")\n\t\tthis.onbeforesort();\n\n\tvar f = this.getSortFunction(sSortType, nColumn);\n\tvar a = this.getCache(sSortType, nColumn);\n\tvar tBody = this.tBody;\n\n\ta.sort(f);\n\n\tif (this.descending)\n\t\ta.reverse();\n\n\tif (SortableTable.removeBeforeSort) {\n\t\t// remove from doc\n\t\tvar nextSibling = tBody.nextSibling;\n\t\tvar p = tBody.parentNode;\n\t\tp.removeChild(tBody);\n\t}\n\n\t// insert in the new order\n\tvar l = a.length;\n\tfor (var i = 0; i < l; i++)\n\t\ttBody.appendChild(a[i].element);\n\n\tif (SortableTable.removeBeforeSort) {\n\t\t// insert into doc\n\t\tp.insertBefore(tBody, nextSibling);\n\t}\n\n\tthis.updateHeaderArrows();\n\n\tthis.destroyCache(a);\n\n\tif (typeof this.onsort == "function")\n\t\tthis.onsort();\n};\n\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\n\tvar oThis = this;\n\tthis._asyncsort = function () {\n\t\toThis.sort(nColumn, bDescending, sSortType);\n\t};\n\twindow.setTimeout(this._asyncsort, 1);\n};\n\nSortableTable.prototype.getCache = function (sType, nColumn) {\n\tif (!this.tBody) return [];\n\tvar rows = this.tBody.rows;\n\tvar l = rows.length;\n\tvar a = new Array(l);\n\tvar r;\n\tfor (var i = 0; i < l; i++) {\n\t\tr = rows[i];\n\t\ta[i] = {\n\t\t\tvalue:\t\tthis.getRowValue(r, sType, nColumn),\n\t\t\telement:\tr\n\t\t};\n\t};\n\treturn a;\n};\n\nSortableTable.prototype.destroyCache = function (oArray) {\n\tvar l = oArray.length;\n\tfor (var i = 0; i < l; i++) {\n\t\toArray[i].value = null;\n\t\toArray[i].element = null;\n\t\toArray[i] = null;\n\t}\n};\n\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\n\t// if we have defined a custom getRowValue use that\n\tif (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\n\t\treturn this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\n\n\tvar s;\n\tvar c = oRow.cells[nColumn];\n\tif (typeof c.innerText != "undefined")\n\t\ts = c.innerText;\n\telse\n\t\ts = SortableTable.getInnerText(c);\n\treturn this.getValueFromString(s, sType);\n};\n\nSortableTable.getInnerText = function (oNode) {\n\tvar s = "";\n\tvar cs = oNode.childNodes;\n\tvar l = cs.length;\n\tfor (var i = 0; i < l; i++) {\n\t\tswitch (cs[i].nodeType) {\n\t\t\tcase 1: //ELEMENT_NODE\n\t\t\t\ts += SortableTable.getInnerText(cs[i]);\n\t\t\t\tbreak;\n\t\t\tcase 3:\t//TEXT_NODE\n\t\t\t\ts += cs[i].nodeValue;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\treturn s;\n};\n\nSortableTable.prototype.getValueFromString = function (sText, sType) {\n\tif (this._sortTypeInfo[sType])\n\t\treturn this._sortTypeInfo[sType].getValueFromString( sText );\n\treturn sText;\n\t/*\n\tswitch (sType) {\n\t\tcase "Number":\n\t\t\treturn Number(sText);\n\t\tcase "CaseInsensitiveString":\n\t\t\treturn sText.toUpperCase();\n\t\tcase "Date":\n\t\t\tvar parts = sText.split("-");\n\t\t\tvar d = new Date(0);\n\t\t\td.setFullYear(parts[0]);\n\t\t\td.setDate(parts[2]);\n\t\t\td.setMonth(parts[1] - 1);\n\t\t\treturn d.valueOf();\n\t}\n\treturn sText;\n\t*/\n\t};\n\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\n\tif (this._sortTypeInfo[sType])\n\t\treturn this._sortTypeInfo[sType].compare;\n\treturn SortableTable.basicCompare;\n};\n\nSortableTable.prototype.destroy = function () {\n\tthis.uninitHeader();\n\tvar win = this.document.parentWindow;\n\tif (win && typeof win.detachEvent != "undefined") {\t// only IE needs this\n\t\twin.detachEvent("onunload", this._onunload);\n\t}\n\tthis._onunload = null;\n\tthis.element = null;\n\tthis.tHead = null;\n\tthis.tBody = null;\n\tthis.document = null;\n\tthis._headerOnclick = null;\n\tthis.sortTypes = null;\n\tthis._asyncsort = null;\n\tthis.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\tthis._sortTypeInfo[sType] = {\n\t\ttype:\t\t\t\tsType,\n\t\tgetValueFromString:\tfGetValueFromString || SortableTable.idFunction,\n\t\tcompare:\t\t\tfCompareFunction || SortableTable.basicCompare,\n\t\tgetRowValue:\t\tfGetRowValue\n\t};\n};\n\n// this removes the sort type from all instances of SortableTable\nSortableTable.prototype.removeSortType = function (sType) {\n\tdelete this._sortTypeInfo[sType];\n};\n\nSortableTable.basicCompare = function compare(n1, n2) {\n\tif (n1.value < n2.value)\n\t\treturn -1;\n\tif (n2.value < n1.value)\n\t\treturn 1;\n\treturn 0;\n};\n\nSortableTable.idFunction = function (x) {\n\treturn x;\n};\n\nSortableTable.toUpperCase = function (s) {\n\treturn s.toUpperCase();\n};\n\nSortableTable.toDate = function (s) {\n\tvar parts = s.split("-");\n\tvar d = new Date(0);\n\td.setFullYear(parts[0]);\n\td.setDate(parts[2]);\n\td.setMonth(parts[1] - 1);\n\treturn 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'}});