1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-05-01 06:12:59 +02:00
TableFilter/dist/tablefilter/tf-1.js

8 lines
48 KiB
JavaScript

/**
* tablefilter v0.2.38 by Max Guglielmi
* build date: 2016-06-15T01:25:33.737Z
* MIT License
*/
webpackJsonp([1],{30:function(e,t,n){function r(e){return n(o(e))}function o(e){return i[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}var i={"./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};r.keys=function(){return Object.keys(i)},r.resolve=o,e.exports=r,r.id=30},31:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(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 i(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 s=n(10),l=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,i){r(this,t);var s=o(this,e.call(this,n,i.name));return s.initialized=!1,s.desc=i.description||"ezEditTable adapter",s.filename=i.filename||"ezEditTable.js",s.vendorPath=i.vendor_path,s.loadStylesheet=Boolean(i.load_stylesheet),s.stylesheet=i.stylesheet||s.vendorPath+"ezEditTable.css",s.stylesheetName=i.stylesheet_name||"ezEditTableCss",i.scroll_into_view=i.scroll_into_view===!1?!1:n.gridLayout,s._ezEditTable=null,s.cfg=i,s.enable(),s}return i(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,t=this.tf,n=this.cfg,r=(0,l.tag)(t.tbl,"thead");e=r.length>0&&!n.startRow?void 0:n.startRow||t.refRow,n.base_path=n.base_path||t.basePath+"ezEditTable/";var o=n.editable,i=n.selection;i&&(n.default_selection=n.default_selection||"row"),n.active_cell_css=n.active_cell_css||"ezETSelectedCell";var s=0,a=0;if(i){var d=function(e,n,r){var o=e.Selection,i=function(r){if("row"===e.defaultSelection)o.SelectRowByIndex(r);else{e.ClearSelections();var i=n.cellIndex,s=t.tbl.rows[r];"both"===e.defaultSelection&&o.SelectRowByIndex(r),s&&o.SelectCell(s.cells[i])}if(t.validRowsIndex.length!==t.getRowsNb()){var l=t.tbl.rows[r];l&&l.scrollIntoView(!1),h&&(h.cellIndex===t.getCellsNb()-1&&t.gridLayout?t.tblCont.scrollLeft=1e8:0===h.cellIndex&&t.gridLayout?t.tblCont.scrollLeft=0:h.scrollIntoView(!1))}};if(t.validRowsIndex){var l,d=t.validRowsIndex,c=d.length,u="row"!==e.defaultSelection?n.parentNode:n,h="TD"===n.nodeName?n:null,p=void 0!==r?e.Event.GetKey(r):0,f=-1!==d.indexOf(u.rowIndex),b=t.feature("paging"),m=34===p||33===p?b&&b.pagingLength||e.nbRowsPerPage:1;if(f)34!==p&&33!==p?(s=d.indexOf(u.rowIndex),a=u.rowIndex):(l=34===p?c-1>=s+m?d[s+m]:[c-1]:s-m<=d[0]?d[0]:d[s-m],a=l,s=d.indexOf(l),i(l));else{if(u.rowIndex>a)if(u.rowIndex>=d[c-1])l=d[c-1];else{var y=s+m;l=y>c-1?d[c-1]:d[y]}else if(u.rowIndex<=d[0])l=d[0];else{var g=d[s-m];l=g?g:d[0]}a=u.rowIndex,i(l)}}},u=function(e,n){var r="row"!==e.defaultSelection?n.parentNode:n;if(t.paging&&t.feature("paging").nbPages>1){var o=t.feature("paging");e.nbRowsPerPage=o.pagingLength;var i=t.validRowsIndex,s=i.length,l=parseInt(o.startPagingRow,10)+parseInt(o.pagingLength,10),a=r.rowIndex;a===i[s-1]&&o.currentPageNb!==o.nbPages?o.setPage("last"):a===i[0]&&1!==o.currentPageNb?o.setPage("first"):a>i[l-1]&&a<i[s-1]?o.setPage("next"):a<i[o.startPagingRow]&&a>i[0]&&o.setPage("previous")}};if(t.paging&&(t.feature("paging").onAfterChangePage=function(e){var t=e.tf.extension("advancedGrid"),n=t._ezEditTable,r=n.Selection,o=r.GetActiveRow();o&&o.scrollIntoView(!1);var i=r.GetActiveCell();i&&i.scrollIntoView(!1)}),"row"===n.default_selection){var h=n.on_before_selected_row;n.on_before_selected_row=function(){u(arguments[0],arguments[1],arguments[2]),h&&h.call(null,arguments[0],arguments[1],arguments[2])};var p=n.on_after_selected_row;n.on_after_selected_row=function(){d(arguments[0],arguments[1],arguments[2]),p&&p.call(null,arguments[0],arguments[1],arguments[2])}}else{var f=n.on_before_selected_cell;n.on_before_selected_cell=function(){u(arguments[0],arguments[1],arguments[2]),f&&f.call(null,arguments[0],arguments[1],arguments[2])};var b=n.on_after_selected_cell;n.on_after_selected_cell=function(){d(arguments[0],arguments[1],arguments[2]),b&&b.call(null,arguments[0],arguments[1],arguments[2])}}}if(o){var m=n.on_added_dom_row;if(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(),m&&m.call(null,arguments[0],arguments[1],arguments[2])},n.actions&&n.actions["delete"]){var y=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(),y&&y.call(null,arguments[0],arguments[1])}}}try{this._ezEditTable=new EditTable(t.id,n,e),this._ezEditTable.Init()}catch(g){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}(s.Feature);t["default"]=u},32:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(31),i=r(o);t["default"]=i["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.tf.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);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,nbvalues=0,temp,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;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)}},ColOps.prototype.destroy=function(){var e=this;this.initialized&&(this.tf.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 r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(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 i(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 s=n(10),l=n(3),a=n(4),d=n(1),c=function(e){function t(n,i){r(this,t);var s=o(this,e.call(this,n,i.name)),d=n.config();return s.initialized=!1,s.name=i.name,s.desc=i.description||"Columns visibility manager",s.spanEl=null,s.btnEl=null,s.contEl=null,s.tickToHide=i.tick_to_hide!==!1,s.manager=i.manager!==!1,s.headersTbl=i.headers_table||!1,s.headersIndex=i.headers_index||1,s.contElTgtId=i.container_target_id||null,s.headersText=i.headers_text||null,s.btnTgtId=i.btn_target_id||null,s.btnText=i.btn_text||"Columns&#9660;",s.btnHtml=i.btn_html||null,s.btnCssClass=i.btn_css_class||"colVis",s.btnCloseText=i.btn_close_text||"Close",s.btnCloseHtml=i.btn_close_html||null,s.btnCloseCssClass=i.btn_close_css_class||s.btnCssClass,s.stylesheet=i.stylesheet||"colsVisibility.css",s.prfx="colVis_",s.spanCssClass=i.span_css_class||"colVisSpan",s.prfxCont=s.prfx+"Cont_",s.contCssClass=i.cont_css_class||"colVisCont",s.listCssClass=d.list_css_class||"cols_checklist",s.listItemCssClass=d.checklist_item_css_class||"cols_checklist_item",s.listSlcItemCssClass=d.checklist_selected_item_css_class||"cols_checklist_slc_item",s.text=i.text||(s.tickToHide?"Hide: ":"Show: "),s.atStart=i.at_start||null,s.enableHover=Boolean(i.enable_hover),s.enableTickAll=Boolean(i.enable_tick_all),s.tickAllText=i.tick_all_text||"Select all:",s.hiddenCols=[],s.tblHasColTag=(0,l.tag)(n.tbl,"col").length>0,s.onLoaded=(0,a.isFn)(i.on_loaded)?i.on_loaded:null,s.onBeforeOpen=(0,a.isFn)(i.on_before_open)?i.on_before_open:null,s.onAfterOpen=(0,a.isFn)(i.on_after_open)?i.on_after_open:null,s.onBeforeClose=(0,a.isFn)(i.on_before_close)?i.on_before_close:null,s.onAfterClose=(0,a.isFn)(i.on_after_close)?i.on_after_close:null,s.onBeforeColHidden=(0,a.isFn)(i.on_before_col_hidden)?i.on_before_col_hidden:null,s.onAfterColHidden=(0,a.isFn)(i.on_after_col_hidden)?i.on_after_col_hidden:null,s.onBeforeColDisplayed=(0,a.isFn)(i.on_before_col_displayed)?i.on_before_col_displayed:null,s.onAfterColDisplayed=(0,a.isFn)(i.on_after_col_displayed)?i.on_after_col_displayed:null,n.gridLayout&&(s.headersTbl=n.feature("gridLayout").headTbl,s.headersIndex=0,s.onAfterColDisplayed=function(){},s.onAfterColHidden=function(){}),n["import"](i.name+"Style",n.stylePath+s.stylesheet,null,"link"),s.enable(),s}return i(t,e),t.prototype.toggle=function(){var e=this.contEl.style.display,t=this.onBeforeOpen,n=this.onBeforeClose,r=this.onAfterOpen,o=this.onAfterClose;t&&"inline"!==e&&t.call(null,this),n&&"inline"===e&&n.call(null,this),this.contEl.style.display="inline"===e?"none":"inline",r&&"inline"!==e&&r.call(null,this),o&&"inline"===e&&o.call(null,this)},t.prototype.checkItem=function(e){var t=e.parentNode;if(t&&e){var n=e.firstChild.checked,r=e.firstChild.getAttribute("id").split("_")[1];r=parseInt(r,10),n?(0,l.addClass)(t,this.listSlcItemCssClass):(0,l.removeClass)(t,this.listSlcItemCssClass);var o=!1;(this.tickToHide&&n||!this.tickToHide&&!n)&&(o=!0),this.setHidden(r,o)}},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,l.createElm)("span",["id",this.prfx+t.id]);n.className=this.spanCssClass,this.btnTgtId||t.setToolbar();var r=this.btnTgtId?(0,l.elm)(this.btnTgtId):t.rDiv;if(this.btnTgtId)r.appendChild(n);else{var o=r.firstChild;o.parentNode.insertBefore(n,o)}if(this.btnHtml){n.innerHTML=this.btnHtml;var i=n.firstChild;this.enableHover?(0,d.addEvt)(i,"mouseover",function(t){return e.toggle(t)}):(0,d.addEvt)(i,"click",function(t){return e.toggle(t)})}else{var s=(0,l.createElm)("a",["href","javascript:;"]);s.className=this.btnCssClass,s.title=this.desc,s.innerHTML=this.btnText,n.appendChild(s),this.enableHover?(0,d.addEvt)(s,"mouseover",function(t){return e.toggle(t)}):(0,d.addEvt)(s,"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,l.elm)(this.contElTgtId):(0,l.createElm)("div",["id",this.prfxCont+t.id]);n.className=this.contCssClass;var r=(0,l.createElm)("p");r.innerHTML=this.text,n.appendChild(r);var o=(0,l.createElm)("ul",["id","ul"+this.name+"_"+t.id]);o.className=this.listCssClass;var i=this.headersTbl?this.headersTbl:t.tbl,s=this.headersTbl?this.headersIndex:t.getHeadersRowIndex(),a=i.rows[s];this.enableTickAll&&!function(){var n=(0,l.createCheckItem)("col__"+t.id,e.tickAllText,e.tickAllText);(0,l.addClass)(n,e.listItemCssClass),o.appendChild(n),n.check.checked=!e.tickToHide,(0,d.addEvt)(n.check,"click",function(){for(var e=0;e<a.cells.length;e++){var r=(0,l.elm)("col_"+e+"_"+t.id);r&&n.check.checked!==r.checked&&(r.click(),r.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,l.createCheckItem)("col_"+c+"_"+t.id,h,h);(0,l.addClass)(p,this.listItemCssClass),this.tickToHide||(0,l.addClass)(p,this.listSlcItemCssClass),o.appendChild(p),this.tickToHide||(p.check.checked=!0),(0,d.addEvt)(p.check,"click",function(t){var n=(0,d.targetEvt)(t),r=n.parentNode;e.checkItem(r)})}var f=(0,l.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,l.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(o),n.appendChild(f),this.btnEl.parentNode.insertBefore(n,this.btnEl),this.contEl=n},t.prototype.setHidden=function(e,t){var n=this.tf,r=n.tbl;this.onBeforeColHidden&&t&&this.onBeforeColHidden.call(null,this,e),this.onBeforeColDisplayed&&!t&&this.onBeforeColDisplayed.call(null,this,e),this._hideCells(r,e,t),this.headersTbl&&this._hideCells(this.headersTbl,e,t);var o=this.hiddenCols,i=o.indexOf(e);t?-1===i&&this.hiddenCols.push(e):-1!==i&&this.hiddenCols.splice(i,1);var s=void 0,l=void 0,a=void 0;if(t){if(n.gridLayout){s=n.feature("gridLayout"),l=s.headTbl,a=s.colElms;var d=parseInt(a[e].style.width,10),c=parseInt(l.style.width,10);l.style.width=c-d+"px",r.style.width=l.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){s=n.feature("gridLayout"),l=s.headTbl,a=s.colElms;var u=parseInt(a[e].style.width,10);l.style.width=parseInt(l.style.width,10)+u+"px",n.tbl.style.width=l.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,l.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,l.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,l.elm)(this.contElTgtId)?(0,l.elm)(this.contElTgtId).innerHTML="":(this.contEl.innerHTML="",(0,l.removeElm)(this.contEl),this.contEl=null),this.btnEl.innerHTML="",(0,l.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,l.getText)(n)}}return""},t.prototype._hideCells=function(e,t,n){for(var r=0;r<e.rows.length;r++){var o=e.rows[r],i=o.cells[t];i&&(i.style.display=n?"none":"")}},t.prototype._hideAtStart=function(){var e=this;this.atStart&&this.atStart.forEach(function(t){e.hideCol(t)})},t}(s.Feature);t["default"]=c},35:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(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 i(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 s=n(10),l=n(3),a=n(4),d=n(1),c=function(e){function t(n,i){r(this,t);var s=o(this,e.call(this,n,i.name));return s.name=i.name,s.desc=i.description||"Filters row visibility manager",s.stylesheet=i.stylesheet||"filtersVisibility.css",s.icnExpand=i.expand_icon_name||"icn_exp.png",s.icnCollapse=i.collapse_icon_name||"icn_clp.png",s.contEl=null,s.btnEl=null,s.icnExpandHtml='<img src="'+n.themesPath+s.icnExpand+'" alt="Expand filters" >',s.icnCollapseHtml='<img src="'+n.themesPath+s.icnCollapse+'" alt="Collapse filters" >',s.defaultText="Toggle filters",s.targetId=i.target_id||null,s.enableIcon=i.enable_icon!==!1,s.btnText=i.btn_text||"",s.collapseBtnHtml=s.enableIcon?s.icnCollapseHtml+s.btnText:s.btnText||s.defaultText,s.expandBtnHtml=s.enableIcon?s.icnExpandHtml+s.btnText:s.btnText||s.defaultText,s.btnHtml=i.btn_html||null,s.btnCssClass=i.btn_css_class||"btnExpClpFlt",s.contCssClass=i.cont_css_class||"expClpFlt",s.filtersRowIndex=(0,a.isUndef)(i.filters_row_index)?n.getFiltersRowIndex():i.filters_row_index,s.visibleAtStart=(0,a.isUndef)(i.visible_at_start)?!0:Boolean(i.visible_at_start),s.prfx="fltsVis_",s.onBeforeShow=(0,a.isFn)(i.on_before_show)?i.on_before_show:null,s.onAfterShow=(0,a.isFn)(i.on_after_show)?i.on_after_show:null,s.onBeforeHide=(0,a.isFn)(i.on_before_hide)?i.on_before_hide:null,s.onAfterHide=(0,a.isFn)(i.on_after_hide)?i.on_after_hide:null,n["import"](i.name+"Style",n.stylePath+s.stylesheet,null,"link"),s.enable(),s}return i(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,l.createElm)("span",["id",this.prfx+t.id]);n.className=this.contCssClass,this.targetId||t.setToolbar();var r=this.targetId?(0,l.elm)(this.targetId):t.rDiv;if(this.targetId)r.appendChild(n);else{var o=r.firstChild;o.parentNode.insertBefore(n,o)}var i=void 0;this.btnHtml?(n.innerHTML=this.btnHtml,i=n.firstChild):(i=(0,l.createElm)("a",["href","javascript:void(0);"]),i.className=this.btnCssClass,i.title=this.btnText||this.defaultText,i.innerHTML=this.collapseBtnHtml,n.appendChild(i)),(0,d.addEvt)(i,"click",function(){return e.toggle()}),this.contEl=n,this.btnEl=i,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],r=""===n.style.display;this.show(!r)},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,r=n.rows[this.filtersRowIndex];this.onBeforeShow&&e&&this.onBeforeShow.call(this,this),this.onBeforeHide&&!e&&this.onBeforeHide.call(null,this),r.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,l.removeElm)(this.btnEl),this.btnEl=null,this.contEl.innerHTML="",(0,l.removeElm)(this.contEl),this.contEl=null,this.initialized=!1)},t}(s.Feature);t["default"]=c},36:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(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 i(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 s(e){return(0,v.removeNbFormat)(e,"us")}function l(e){return(0,v.removeNbFormat)(e,"eu")}function a(e,t){return(0,T.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 r=t[n];3>r.length;)r="0"+r;t[n]=r}return t.join(".")}function f(e,t){var n=p(e.value.toLowerCase()),r=p(t.value.toLowerCase());return n===r?0:r>n?-1:1}Object.defineProperty(t,"__esModule",{value:!0});var b=n(10),m=n(4),y=n(3),g=n(1),T=n(6),v=n(7),_=n(11),C=function(e){function t(n,i){r(this,t);var s=o(this,e.call(this,n,i.name));return s.name=i.name,s.desc=i.description||"Sortable table",s.sorted=!1,s.sortTypes=(0,m.isArray)(i.types)?i.types:[],s.sortColAtStart=(0,m.isArray)(i.sort_col_at_start)?i.sort_col_at_start:null,s.asyncSort=Boolean(i.async_sort),s.triggerIds=(0,m.isArray)(i.trigger_ids)?i.trigger_ids:[],s.imgPath=i.images_path||n.themesPath,s.imgBlank=i.image_blank||"blank.png",s.imgClassName=i.image_class_name||"sort-arrow",s.imgAscClassName=i.image_asc_class_name||"ascending",s.imgDescClassName=i.image_desc_class_name||"descending",s.customKey=i.custom_key||"data-tf-sortKey",s.onSortLoaded=(0,m.isFn)(i.on_sort_loaded)?i.on_sort_loaded:null,s.onBeforeSort=(0,m.isFn)(i.on_before_sort)?i.on_before_sort:null,s.onAfterSort=(0,m.isFn)(i.on_after_sort)?i.on_after_sort:null,s.enable(),s}return i(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 r=n.sortColAtStart;r&&this.stt.sort(r[0],r[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,r){return e.sortByColumnIndex(n,r)}),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!==_.CELL_TAG&&n.tagName!==_.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,r=void 0;for(r=0;t[r]!==e&&n>r;r++);return r},SortableTable.prototype.initHeader=function(n){var r=this;if(!r.tHead){if(!t.gridLayout)return;r.tHead=t.feature("gridLayout").headTbl.tHead}r.headersRow=t.headersRow;var o=r.tHead.rows[r.headersRow].cells;r.sortTypes=n||[];for(var i=o.length,s=void 0,l=void 0,a=0;i>a;a++)l=o[a],null!==r.sortTypes[a]&&"None"!==r.sortTypes[a]?(l.style.cursor="pointer",s=(0,y.createElm)("img",["src",e.imgPath+e.imgBlank]),l.appendChild(s),null!==r.sortTypes[a]&&l.setAttribute("_sortType",r.sortTypes[a]),(0,g.addEvt)(l,"click",r._headerOnclick)):(l.setAttribute("_sortType",n[a]),l._sortType="None");r.updateHeaderArrows()},SortableTable.prototype.updateHeaderArrows=function(){var t=this,n=void 0,r=void 0,o=void 0;if(e.asyncSort&&e.triggerIds.length>0){var i=e.triggerIds;n=[],r=i.length;for(var s=0;s<i.length;s++)n.push((0,y.elm)(i[s]))}else{if(!this.tHead)return;n=t.tHead.rows[t.headersRow].cells,r=n.length}for(var l=0;r>l;l++){var a=n[l].getAttribute("_sortType");null!==a&&"None"!==a&&(o=n[l].lastChild||n[l],"img"!==o.nodeName.toLowerCase()&&(o=(0,y.createElm)("img",["src",e.imgPath+e.imgBlank]),n[l].appendChild(o)),l===t.sortColumn?o.className=e.imgClassName+" "+(this.descending?e.imgDescClassName:e.imgAscClassName):o.className=e.imgClassName)}},SortableTable.prototype.getRowValue=function(e,t,n){var r=this,o=r._sortTypeInfo[t];if(o&&o.getRowValue)return o.getRowValue(e,n);var i=e.cells[n],s=SortableTable.getInnerText(i);return r.getValueFromString(s,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,r=[],o=0;o<t.nbCells;o++){var i=void 0;n[o]?(i=n[o].toLowerCase(),i===_.NONE&&(i="None")):i=t.hasColNbFormat&&null!==t.colNbFormat[o]?t.colNbFormat[o].toLowerCase():t.hasColDateType&&null!==t.colDateType[o]?t.colDateType[o].toLowerCase()+"date":"String",r.push(i)}this.addSortType("number",Number),this.addSortType("caseinsensitivestring",SortableTable.toUpperCase),this.addSortType("date",SortableTable.toDate),this.addSortType("string"),this.addSortType("us",s),this.addSortType("eu",l),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,r),this.asyncSort&&this.triggerIds.length>0&&!function(){for(var t=e.triggerIds,n=0;n<t.length;n++)if(null!==t[n]){var o=(0,y.elm)(t[n]);o&&(o.style.cursor="pointer",(0,g.addEvt)(o,"click",function(n){var r=n.target;e.tf.sort&&e.stt.asyncSort(t.indexOf(r.id))}),o.setAttribute("_sortType",r[n]))}}()},t.prototype.destroy=function(){var e=this;if(this.initialized){var t=this.tf;this.emitter.off(["sort"],function(t,n,r){return e.sortByColumnIndex(n,r)}),this.sorted=!1,this.initialized=!1,this.stt.destroy();for(var n=t.getFiltersId(),r=0;r<n.length;r++){var o=t.getHeaderElement(r),i=(0,y.tag)(o,"img");1===i.length&&o.removeChild(i[0])}this.initialized=!1}},t}(b.Feature);t["default"]=C},37:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(36),i=r(o),s=n(2);s.root.SortableTable||n(38),t["default"]=i["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='/*----------------------------------------------------------------------------\\\r\n| Sortable Table 1.12 |\r\n|-----------------------------------------------------------------------------|\r\n| Created by Erik Arvidsson |\r\n| (http://webfx.eae.net/contact.html#erik) |\r\n| For WebFX (http://webfx.eae.net/) |\r\n|-----------------------------------------------------------------------------|\r\n| A DOM 1 based script that allows an ordinary HTML table to be sortable. |\r\n|-----------------------------------------------------------------------------|\r\n| Copyright (c) 1998 - 2006 Erik Arvidsson |\r\n|-----------------------------------------------------------------------------|\r\n| Licensed under the Apache License, Version 2.0 (the "License"); you may not |\r\n| use this file except in compliance with the License. You may obtain a copy |\r\n| of the License at http://www.apache.org/licenses/LICENSE-2.0 |\r\n| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |\r\n| Unless required by applicable law or agreed to in writing, software |\r\n| distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |\r\n| WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |\r\n| License for the specific language governing permissions and limitations |\r\n| under the License. |\r\n|-----------------------------------------------------------------------------|\r\n| 2003-01-10 | First version |\r\n| 2003-01-19 | Minor changes to the date parsing |\r\n| 2003-01-28 | JScript 5.0 fixes (no support for \'in\' operator) |\r\n| 2003-02-01 | Sloppy typo like error fixed in getInnerText |\r\n| 2003-07-04 | Added workaround for IE cellIndex bug. |\r\n| 2003-11-09 | The bDescending argument to sort was not correctly working |\r\n| | Using onclick DOM0 event if no support for addEventListener |\r\n| | or attachEvent |\r\n| 2004-01-13 | Adding addSortType and removeSortType which makes it a lot |\r\n| | easier to add new, custom sort types. |\r\n| 2004-01-27 | Switch to use descending = false as the default sort order. |\r\n| | Change defaultDescending to suit your needs. |\r\n| 2004-03-14 | Improved sort type None look and feel a bit |\r\n| 2004-08-26 | Made the handling of tBody and tHead more flexible. Now you |\r\n| | can use another tHead or no tHead, and you can chose some |\r\n| | other tBody. |\r\n| 2006-04-25 | Changed license to Apache Software License 2.0 |\r\n|-----------------------------------------------------------------------------|\r\n| Created 2003-01-10 | All changes are in the log above. | Updated 2006-04-25 |\r\n\\----------------------------------------------------------------------------*/\r\n\r\n\r\nfunction SortableTable(oTable, oSortTypes) {\r\n\r\n this.sortTypes = oSortTypes || [];\r\n\r\n this.sortColumn = null;\r\n this.descending = null;\r\n\r\n var oThis = this;\r\n this._headerOnclick = function (e) {\r\n oThis.headerOnclick(e);\r\n };\r\n\r\n if (oTable) {\r\n this.setTable( oTable );\r\n this.document = oTable.ownerDocument || oTable.document;\r\n }\r\n else {\r\n this.document = document;\r\n }\r\n\r\n\r\n // only IE needs this\r\n var win = this.document.defaultView || this.document.parentWindow;\r\n this._onunload = function () {\r\n oThis.destroy();\r\n };\r\n if (win && typeof win.attachEvent != "undefined") {\r\n win.attachEvent("onunload", this._onunload);\r\n }\r\n}\r\n\r\nSortableTable.gecko = navigator.product == "Gecko";\r\nSortableTable.msie = /msie/i.test(navigator.userAgent);\r\n// Mozilla is faster when doing the DOM manipulations on\r\n// an orphaned element. MSIE is not\r\nSortableTable.removeBeforeSort = SortableTable.gecko;\r\n\r\nSortableTable.prototype.onsort = function () {};\r\n\r\n// default sort order. true -> descending, false -> ascending\r\nSortableTable.prototype.defaultDescending = false;\r\n\r\n// shared between all instances. This is intentional to allow external files\r\n// to modify the prototype\r\nSortableTable.prototype._sortTypeInfo = {};\r\n\r\nSortableTable.prototype.setTable = function (oTable) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.element = oTable;\r\n this.setTHead( oTable.tHead );\r\n this.setTBody( oTable.tBodies[0] );\r\n};\r\n\r\nSortableTable.prototype.setTHead = function (oTHead) {\r\n if (this.tHead && this.tHead != oTHead )\r\n this.uninitHeader();\r\n this.tHead = oTHead;\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\nSortableTable.prototype.setTBody = function (oTBody) {\r\n this.tBody = oTBody;\r\n};\r\n\r\nSortableTable.prototype.setSortTypes = function ( oSortTypes ) {\r\n if ( this.tHead )\r\n this.uninitHeader();\r\n this.sortTypes = oSortTypes || [];\r\n if ( this.tHead )\r\n this.initHeader( this.sortTypes );\r\n};\r\n\r\n// adds arrow containers and events\r\n// also binds sort type to the header cells so that reordering columns does\r\n// not break the sort types\r\nSortableTable.prototype.initHeader = function (oSortTypes) {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var doc = this.tHead.ownerDocument || this.tHead.document;\r\n this.sortTypes = oSortTypes || [];\r\n var l = cells.length;\r\n var img, c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (this.sortTypes[i] != null && this.sortTypes[i] != "None") {\r\n img = doc.createElement("IMG");\r\n img.src = "images/blank.png";\r\n c.appendChild(img);\r\n if (this.sortTypes[i] != null)\r\n c._sortType = this.sortTypes[i];\r\n if (typeof c.addEventListener != "undefined")\r\n c.addEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.attachEvent != "undefined")\r\n c.attachEvent("onclick", this._headerOnclick);\r\n else\r\n c.onclick = this._headerOnclick;\r\n }\r\n else\r\n {\r\n c.setAttribute( "_sortType", oSortTypes[i] );\r\n c._sortType = "None";\r\n }\r\n }\r\n this.updateHeaderArrows();\r\n};\r\n\r\n// remove arrows and events\r\nSortableTable.prototype.uninitHeader = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var c;\r\n for (var i = 0; i < l; i++) {\r\n c = cells[i];\r\n if (c._sortType != null && c._sortType != "None") {\r\n c.removeChild(c.lastChild);\r\n if (typeof c.removeEventListener != "undefined")\r\n c.removeEventListener("click", this._headerOnclick, false);\r\n else if (typeof c.detachEvent != "undefined")\r\n c.detachEvent("onclick", this._headerOnclick);\r\n c._sortType = null;\r\n c.removeAttribute( "_sortType" );\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.updateHeaderArrows = function () {\r\n if (!this.tHead) return;\r\n var cells = this.tHead.rows[0].cells;\r\n var l = cells.length;\r\n var img;\r\n for (var i = 0; i < l; i++) {\r\n if (cells[i]._sortType != null && cells[i]._sortType != "None") {\r\n img = cells[i].lastChild;\r\n if (i == this.sortColumn)\r\n img.className = "sort-arrow " + (this.descending ? "descending" : "ascending");\r\n else\r\n img.className = "sort-arrow";\r\n }\r\n }\r\n};\r\n\r\nSortableTable.prototype.headerOnclick = function (e) {\r\n // find TD element\r\n var el = e.target || e.srcElement;\r\n while (el.tagName != "TD")\r\n el = el.parentNode;\r\n\r\n this.sort(SortableTable.msie ? SortableTable.getCellIndex(el) : el.cellIndex);\r\n};\r\n\r\n// IE returns wrong cellIndex when columns are hidden\r\nSortableTable.getCellIndex = function (oTd) {\r\n var cells = oTd.parentNode.childNodes\r\n var l = cells.length;\r\n var i;\r\n for (i = 0; cells[i] != oTd && i < l; i++)\r\n ;\r\n return i;\r\n};\r\n\r\nSortableTable.prototype.getSortType = function (nColumn) {\r\n return this.sortTypes[nColumn] || "String";\r\n};\r\n\r\n// only nColumn is required\r\n// if bDescending is left out the old value is taken into account\r\n// if sSortType is left out the sort type is found from the sortTypes array\r\n\r\nSortableTable.prototype.sort = function (nColumn, bDescending, sSortType) {\r\n if (!this.tBody) return;\r\n if (sSortType == null)\r\n sSortType = this.getSortType(nColumn);\r\n\r\n // exit if None\r\n if (sSortType == "None")\r\n return;\r\n\r\n if (bDescending == null) {\r\n if (this.sortColumn != nColumn)\r\n this.descending = this.defaultDescending;\r\n else\r\n this.descending = !this.descending;\r\n }\r\n else\r\n this.descending = bDescending;\r\n\r\n this.sortColumn = nColumn;\r\n\r\n if (typeof this.onbeforesort == "function")\r\n this.onbeforesort();\r\n\r\n var f = this.getSortFunction(sSortType, nColumn);\r\n var a = this.getCache(sSortType, nColumn);\r\n var tBody = this.tBody;\r\n\r\n a.sort(f);\r\n\r\n if (this.descending)\r\n a.reverse();\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // remove from doc\r\n var nextSibling = tBody.nextSibling;\r\n var p = tBody.parentNode;\r\n p.removeChild(tBody);\r\n }\r\n\r\n // insert in the new order\r\n var l = a.length;\r\n for (var i = 0; i < l; i++)\r\n tBody.appendChild(a[i].element);\r\n\r\n if (SortableTable.removeBeforeSort) {\r\n // insert into doc\r\n p.insertBefore(tBody, nextSibling);\r\n }\r\n\r\n this.updateHeaderArrows();\r\n\r\n this.destroyCache(a);\r\n\r\n if (typeof this.onsort == "function")\r\n this.onsort();\r\n};\r\n\r\nSortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) {\r\n var oThis = this;\r\n this._asyncsort = function () {\r\n oThis.sort(nColumn, bDescending, sSortType);\r\n };\r\n window.setTimeout(this._asyncsort, 1);\r\n};\r\n\r\nSortableTable.prototype.getCache = function (sType, nColumn) {\r\n if (!this.tBody) return [];\r\n var rows = this.tBody.rows;\r\n var l = rows.length;\r\n var a = new Array(l);\r\n var r;\r\n for (var i = 0; i < l; i++) {\r\n r = rows[i];\r\n a[i] = {\r\n value: this.getRowValue(r, sType, nColumn),\r\n element: r\r\n };\r\n };\r\n return a;\r\n};\r\n\r\nSortableTable.prototype.destroyCache = function (oArray) {\r\n var l = oArray.length;\r\n for (var i = 0; i < l; i++) {\r\n oArray[i].value = null;\r\n oArray[i].element = null;\r\n oArray[i] = null;\r\n }\r\n};\r\n\r\nSortableTable.prototype.getRowValue = function (oRow, sType, nColumn) {\r\n // if we have defined a custom getRowValue use that\r\n if (this._sortTypeInfo[sType] && this._sortTypeInfo[sType].getRowValue)\r\n return this._sortTypeInfo[sType].getRowValue(oRow, nColumn);\r\n\r\n var s;\r\n var c = oRow.cells[nColumn];\r\n if (typeof c.innerText != "undefined")\r\n s = c.innerText;\r\n else\r\n s = SortableTable.getInnerText(c);\r\n return this.getValueFromString(s, sType);\r\n};\r\n\r\nSortableTable.getInnerText = function (oNode) {\r\n var s = "";\r\n var cs = oNode.childNodes;\r\n var l = cs.length;\r\n for (var i = 0; i < l; i++) {\r\n switch (cs[i].nodeType) {\r\n case 1: //ELEMENT_NODE\r\n s += SortableTable.getInnerText(cs[i]);\r\n break;\r\n case 3: //TEXT_NODE\r\n s += cs[i].nodeValue;\r\n break;\r\n }\r\n }\r\n return s;\r\n};\r\n\r\nSortableTable.prototype.getValueFromString = function (sText, sType) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].getValueFromString( sText );\r\n return sText;\r\n /*\r\n switch (sType) {\r\n case "Number":\r\n return Number(sText);\r\n case "CaseInsensitiveString":\r\n return sText.toUpperCase();\r\n case "Date":\r\n var parts = sText.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n }\r\n return sText;\r\n */\r\n };\r\n\r\nSortableTable.prototype.getSortFunction = function (sType, nColumn) {\r\n if (this._sortTypeInfo[sType])\r\n return this._sortTypeInfo[sType].compare;\r\n return SortableTable.basicCompare;\r\n};\r\n\r\nSortableTable.prototype.destroy = function () {\r\n this.uninitHeader();\r\n var win = this.document.parentWindow;\r\n if (win && typeof win.detachEvent != "undefined") { // only IE needs this\r\n win.detachEvent("onunload", this._onunload);\r\n }\r\n this._onunload = null;\r\n this.element = null;\r\n this.tHead = null;\r\n this.tBody = null;\r\n this.document = null;\r\n this._headerOnclick = null;\r\n this.sortTypes = null;\r\n this._asyncsort = null;\r\n this.onsort = null;\r\n};\r\n\r\n// Adds a sort type to all instance of SortableTable\r\n// sType : String - the identifier of the sort type\r\n// fGetValueFromString : function ( s : string ) : T - A function that takes a\r\n// string and casts it to a desired format. If left out the string is just\r\n// returned\r\n// fCompareFunction : function ( n1 : T, n2 : T ) : Number - A normal JS sort\r\n// compare function. Takes two values and compares them. If left out less than,\r\n// <, compare is used\r\n// fGetRowValue : function( oRow : HTMLTRElement, nColumn : int ) : T - A function\r\n// that takes the row and the column index and returns the value used to compare.\r\n// If left out then the innerText is first taken for the cell and then the\r\n// fGetValueFromString is used to convert that string the desired value and type\r\n\r\nSortableTable.prototype.addSortType = function (sType, fGetValueFromString, fCompareFunction, fGetRowValue) {\r\n this._sortTypeInfo[sType] = {\r\n type: sType,\r\n getValueFromString: fGetValueFromString || SortableTable.idFunction,\r\n compare: fCompareFunction || SortableTable.basicCompare,\r\n getRowValue: fGetRowValue\r\n };\r\n};\r\n\r\n// this removes the sort type from all instances of SortableTable\r\nSortableTable.prototype.removeSortType = function (sType) {\r\n delete this._sortTypeInfo[sType];\r\n};\r\n\r\nSortableTable.basicCompare = function compare(n1, n2) {\r\n if (n1.value < n2.value)\r\n return -1;\r\n if (n2.value < n1.value)\r\n return 1;\r\n return 0;\r\n};\r\n\r\nSortableTable.idFunction = function (x) {\r\n return x;\r\n};\r\n\r\nSortableTable.toUpperCase = function (s) {\r\n return s.toUpperCase();\r\n};\r\n\r\nSortableTable.toDate = function (s) {\r\n var parts = s.split("-");\r\n var d = new Date(0);\r\n d.setFullYear(parts[0]);\r\n d.setDate(parts[2]);\r\n d.setMonth(parts[1] - 1);\r\n return d.valueOf();\r\n};\r\n\r\n\r\n// add sort types\r\nSortableTable.prototype.addSortType("Number", Number);\r\nSortableTable.prototype.addSortType("CaseInsensitiveString", SortableTable.toUpperCase);\r\nSortableTable.prototype.addSortType("Date", SortableTable.toDate);\r\nSortableTable.prototype.addSortType("String");\r\n// None is a special case\r\n'}});