From 672a89111db5c648b25be172ba48bf4904d6d332 Mon Sep 17 00:00:00 2001 From: Max Guglielmi Date: Sun, 24 May 2015 16:50:39 +1000 Subject: [PATCH] Continued adding comments to tablefilter module --- dist/tablefilter/1.js | 4 +- dist/tablefilter/tablefilter.js | 2 +- examples/dev.html | 3 +- src-es6/tablefilter.js | 155 +++++++++++++++++--------------- 4 files changed, 86 insertions(+), 78 deletions(-) diff --git a/dist/tablefilter/1.js b/dist/tablefilter/1.js index f78c5954..5f6b8d24 100644 --- a/dist/tablefilter/1.js +++ b/dist/tablefilter/1.js @@ -1,3 +1,3 @@ -webpackJsonp([1],[,function(t,e,s){function i(t){return s(r(t))}function r(t){return n[t]||function(){throw new Error("Cannot find module '"+t+"'.")}()}var n={"./array":7,"./array.js":7,"./cookie":5,"./cookie.js":5,"./date":8,"./date.js":8,"./dom":3,"./dom.js":3,"./event":2,"./event.js":2,"./extensions/advancedGrid/adapterEzEditTable":25,"./extensions/advancedGrid/adapterEzEditTable.js":25,"./extensions/advancedGrid/advancedGrid":26,"./extensions/advancedGrid/advancedGrid.js":26,"./extensions/colsVisibility/colsVisibility":27,"./extensions/colsVisibility/colsVisibility.js":27,"./extensions/sort/adapterSortabletable":28,"./extensions/sort/adapterSortabletable.js":28,"./extensions/sort/sort":29,"./extensions/sort/sort.js":29,"./helpers":9,"./helpers.js":9,"./modules/alternateRows":22,"./modules/alternateRows.js":22,"./modules/checkList":16,"./modules/checkList.js":16,"./modules/clearButton":20,"./modules/clearButton.js":20,"./modules/colOps":23,"./modules/colOps.js":23,"./modules/dropdown":15,"./modules/dropdown.js":15,"./modules/gridLayout":11,"./modules/gridLayout.js":11,"./modules/help":21,"./modules/help.js":21,"./modules/highlightKeywords":13,"./modules/highlightKeywords.js":13,"./modules/loader":12,"./modules/loader.js":12,"./modules/paging":19,"./modules/paging.js":19,"./modules/popupFilter":14,"./modules/popupFilter.js":14,"./modules/rowsCounter":17,"./modules/rowsCounter.js":17,"./modules/statusBar":18,"./modules/statusBar.js":18,"./modules/store":10,"./modules/store.js":10,"./sort":24,"./sort.js":24,"./string":4,"./string.js":4,"./types":6,"./types.js":6};i.keys=function(){return Object.keys(n)},i.resolve=r,t.exports=i,i.id=1},,,,,,,,,,,,,,,,,,,,,,,,function(t,e,s){"use strict";var i=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},r=function(){function t(t,e){for(var s=0;s0&&!s.startRow?void 0:s.startRow||e.refRow,s.base_path=s.base_path||e.basePath+"ezEditTable/";var r=s.editable,a=s.selectable;s.selection=a,a&&(s.default_selection=s.default_selection||"row"),s.active_cell_css=s.active_cell_css||"ezETSelectedCell";var o=0,h=0;if(a){var d=function(t,s,i){var r=t.Selection,n=function(i){if("row"===t.defaultSelection)r.SelectRowByIndex(i);else{t.ClearSelections();var n=s.cellIndex,l=e.tbl.rows[i];"both"===t.defaultSelection&&r.SelectRowByIndex(i),l&&r.SelectCell(l.cells[n])}if(e.validRowsIndex.length!==e.getRowsNb()){var a=e.tbl.rows[i];a&&a.scrollIntoView(!1),u&&(u.cellIndex===e.getCellsNb()-1&&e.gridLayout?e.tblCont.scrollLeft=1e8:0===u.cellIndex&&e.gridLayout?e.tblCont.scrollLeft=0:u.scrollIntoView(!1))}};if(e.validRowsIndex){var a,d=e.validRowsIndex,c=d.length,p="row"!==t.defaultSelection?s.parentNode:s,u="TD"===s.nodeName?s:null,f=void 0!==i?t.Event.GetKey(i):0,g=l.Arr.has(d,p.rowIndex),v=34===f||33===f?e.Cpt.paging.pagingLength||t.nbRowsPerPage:1;if(g)34!==f&&33!==f?(o=l.Arr.indexByValue(d,p.rowIndex),h=p.rowIndex):(a=34===f?c-1>=o+v?d[o+v]:[c-1]:o-v<=d[0]?d[0]:d[o-v],h=a,o=l.Arr.indexByValue(d,a),n(a));else{if(p.rowIndex>h)if(p.rowIndex>=d[c-1])a=d[c-1];else{var m=o+v;a=m>c-1?d[c-1]:d[m]}else if(p.rowIndex<=d[0])a=d[0];else{var b=d[o-v];a=b?b:d[0]}h=p.rowIndex,n(a)}}},c=function(t,s){var i="row"!==t.defaultSelection?s.parentNode:s;if(e.paging&&e.Cpt.paging.nbPages>1){var r=e.Cpt.paging;t.nbRowsPerPage=r.pagingLength;var n=e.validRowsIndex,l=n.length,a=parseInt(r.startPagingRow,10)+parseInt(r.pagingLength,10),o=i.rowIndex;o===n[l-1]&&r.currentPageNb!==r.nbPages?r.setPage("last"):o==n[0]&&1!==r.currentPageNb?r.setPage("first"):o>n[a-1]&&on[0]&&r.setPage("previous")}};if(e.paging&&(e.Cpt.paging.onAfterChangePage=function(t){var e=t.ExtRegistry.ezEditTable,s=e.Selection,i=s.GetActiveRow();i&&i.scrollIntoView(!1);var r=s.GetActiveCell();r&&r.scrollIntoView(!1)}),"row"===s.default_selection){var p=s.on_before_selected_row;s.on_before_selected_row=function(){c(arguments[0],arguments[1],arguments[2]),p&&p.call(null,arguments[0],arguments[1],arguments[2])};var u=s.on_after_selected_row;s.on_after_selected_row=function(){d(arguments[0],arguments[1],arguments[2]),u&&u.call(null,arguments[0],arguments[1],arguments[2])}}else{var f=s.on_before_selected_cell;s.on_before_selected_cell=function(){c(arguments[0],arguments[1],arguments[2]),f&&f.call(null,arguments[0],arguments[1],arguments[2])};var g=s.on_after_selected_cell;s.on_after_selected_cell=function(){d(arguments[0],arguments[1],arguments[2]),g&&g.call(null,arguments[0],arguments[1],arguments[2])}}}if(r){var v=s.on_added_dom_row;if(s.on_added_dom_row=function(){e.nbFilterableRows++,e.paging?(e.nbRows++,e.nbVisibleRows++,e.nbFilterableRows++,e.paging=!1,e.Cpt.paging.destroy(),e.Cpt.paging.addPaging()):e.Cpt.rowsCounter.refresh(),e.alternateBgs&&e.Cpt.alternateRows.init(),v&&v.call(null,arguments[0],arguments[1],arguments[2])},s.actions&&s.actions["delete"]){var m=s.actions["delete"].on_after_submit;s.actions["delete"].on_after_submit=function(){e.nbFilterableRows--,e.paging?(e.nbRows--,e.nbVisibleRows--,e.nbFilterableRows--,e.paging=!1,e.Cpt.paging.destroy(),e.Cpt.paging.addPaging(!1)):e.Cpt.rowsCounter.refresh(),e.alternateBgs&&e.Cpt.alternateRows.init(),m&&m.call(null,arguments[0],arguments[1])}}}try{this._ezEditTable=new EditTable(e.id,s,t),this._ezEditTable.Init()}catch(b){throw new Error(this.err)}}},{key:"reset",value:function(){var t=this._ezEditTable;t&&(this.cfg.selectable&&t.Selection.Set(),this.cfg.editable&&t.Editable.Set())}},{key:"destroy",value:function(){var t=this._ezEditTable;t&&(this.cfg.selectable&&(t.Selection.ClearSelections(),t.Selection.Remove()),this.cfg.editable&&t.Editable.Remove())}}]),t}();e["default"]=a,t.exports=e["default"]},function(t,e,s){"use strict";var i=function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(e,"__esModule",{value:!0});var r=s(25),n=i(r);e["default"]=n["default"],t.exports=e["default"]},function(t,e,s){"use strict";var i=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},r=function(){function t(t,e){for(var s=0;s0,this.onLoaded=l.Types.isFn(r.on_loaded)?r.on_loaded:null,this.onBeforeOpen=l.Types.isFn(r.on_before_open)?r.on_before_open:null,this.onAfterOpen=l.Types.isFn(r.on_after_open)?r.on_after_open:null,this.onBeforeClose=l.Types.isFn(r.on_before_close)?r.on_before_close:null,this.onAfterClose=l.Types.isFn(r.on_after_close)?r.on_after_close:null,this.onBeforeColHidden=l.Types.isFn(r.on_before_col_hidden)?r.on_before_col_hidden:null,this.onAfterColHidden=l.Types.isFn(r.on_after_col_hidden)?r.on_after_col_hidden:null,this.onBeforeColDisplayed=l.Types.isFn(r.on_before_col_displayed)?r.on_before_col_displayed:null,this.onAfterColDisplayed=l.Types.isFn(r.on_after_col_displayed)?r.on_after_col_displayed:null,e.gridLayout&&(this.headersTbl=e.Cpt.gridLayout.headTbl,this.headersIndex=0,this.onAfterColDisplayed=function(){},this.onAfterColHidden=function(){}),e["import"](r.name+"Style",e.basePath+this.stylesheet,null,"link"),this.tf=e}return r(t,[{key:"toggle",value:function(){var t=this.contEl.style.display,e=this.onBeforeOpen,s=this.onBeforeClose,i=this.onAfterOpen,r=this.onAfterClose;e&&"inline"!==t&&e.call(null,this),s&&"inline"===t&&s.call(null,this),this.contEl.style.display="inline"===t?"none":"inline",i&&"inline"!==t&&i.call(null,this),r&&"inline"===t&&r.call(null,this)}},{key:"checkItem",value:function(t){var e=t.parentNode;if(e&&t){var s=t.firstChild.checked,i=t.firstChild.getAttribute("id").split("_")[1];i=parseInt(i,10),s?n.Dom.addClass(e,this.listSlcItemCssClass):n.Dom.removeClass(e,this.listSlcItemCssClass);var r=!1;(this.tickToHide&&s||!this.tickToHide&&!s)&&(r=!0),this.setHidden(i,r)}}},{key:"init",value:function(){this.manager&&(this.buildBtn(),this.buildManager(),this.initialized=!0)}},{key:"buildBtn",value:function(){var t=this;if(!this.btnEl){var e=this.tf,s=n.Dom.create("span",["id",this.prfx+e.id]);s.className=this.spanCssClass,this.btnTgtId||e.setToolbar();var i=this.btnTgtId?n.Dom.id(this.btnTgtId):e.rDiv;if(this.btnTgtId)i.appendChild(s);else{var r=i.firstChild;r.parentNode.insertBefore(s,r)}if(this.btnHtml){s.innerHTML=this.btnHtml;var l=s.firstChild;this.enableHover?a.Event.add(l,"mouseover",function(e){t.toggle(e)}):a.Event.add(l,"click",function(e){t.toggle(e)})}else{var o=n.Dom.create("a",["href","javascript:;"]);o.className=this.btnCssClass,o.title=this.extDesc,o.innerHTML=this.btnText,s.appendChild(o),this.enableHover?a.Event.add(o,"mouseover",function(e){t.toggle(e)}):a.Event.add(o,"click",function(e){t.toggle(e)})}this.spanEl=s,this.btnEl=this.spanEl.firstChild,this.onLoaded&&this.onLoaded.call(null,this)}}},{key:"buildManager",value:function(){var t=this,e=this.tf,s=this.contElTgtId?n.Dom.id(this.contElTgtId):n.Dom.create("div",["id",this.prfxCont+e.id]);s.className=this.contCssClass;var i=n.Dom.create("p");i.innerHTML=this.text,s.appendChild(i);var r=n.Dom.create("ul",["id","ul"+this.extName+"_"+e.id]);r.className=this.listCssClass;var l=this.headersTbl?this.headersTbl:e.tbl,o=this.headersTbl?this.headersIndex:e.getHeadersRowIndex(),h=l.rows[o];if(this.enableTickAll){var d=n.Dom.createCheckItem("col__"+e.id,this.tickAllText,this.tickAllText);n.Dom.addClass(d,this.listItemCssClass),r.appendChild(d),d.check.checked=!this.tickToHide,a.Event.add(d.check,"click",function(){for(var t=0;ti.length;)i="0"+i;e[s]=i}return e.join(".")}function c(t,e){var s=d(t.value.toLowerCase()),i=d(e.value.toLowerCase());return s==i?0:i>s?-1:1}var p=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},u=function(){function t(t,e){for(var s=0;se;e++);return e},SortableTable.prototype.initHeader=function(s){var i=this;if(i.tHead){i.headersRow=e.headersRow;var r=i.tHead.rows[i.headersRow].cells;i.sortTypes=s||[];for(var n,l,a=r.length,o=0;a>o;o++)l=r[o],null!==i.sortTypes[o]&&"None"!==i.sortTypes[o]?(l.style.cursor="pointer",n=g.Dom.create("img",["src",t.sortImgPath+t.sortImgBlank]),l.appendChild(n),null!==i.sortTypes[o]&&l.setAttribute("_sortType",i.sortTypes[o]),m.Event.add(l,"click",i._headerOnclick)):(l.setAttribute("_sortType",s[o]),l._sortType="None");i.updateHeaderArrows()}},SortableTable.prototype.updateHeaderArrows=function(){var s,i,r,n=this;if(e.sortConfig.asyncSort&&null!==e.sortConfig.triggerIds){var l=e.sortConfig.triggerIds;s=[],i=l.length;for(var a=0;ao;o++){var h=s[o].getAttribute("_sortType");null!==h&&"None"!==h&&(r=s[o].lastChild||s[o],"img"!==r.nodeName.toLowerCase()&&(r=g.Dom.create("img",["src",t.sortImgPath+t.sortImgBlank]),s[o].appendChild(r)),o===n.sortColumn?r.className=t.sortImgClassName+" "+(this.descending?t.sortImgDescClassName:t.sortImgAscClassName):r.className=t.sortImgClassName)}},SortableTable.prototype.getRowValue=function(t,e,s){var i=this,r=i._sortTypeInfo[e];if(r&&r.getRowValue)return r.getRowValue(t,s);var n=t.cells[s],l=SortableTable.getInnerText(n);return i.getValueFromString(l,e)},SortableTable.getInnerText=function(e){return e?e.getAttribute(t.sortCustomKey)?e.getAttribute(t.sortCustomKey):g.Dom.getText(e):void 0}}},{key:"addSortType",value:function(){SortableTable.prototype.addSortType(arguments[0],arguments[1],arguments[2],arguments[3])}},{key:"setSortTypes",value:function(){for(var t=this,e=this.tf,s=e.sortConfig,n=s.sortTypes,p=[],u=0;u 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'; +webpackJsonp([1],[,function(t,e,s){function i(t){return s(r(t))}function r(t){return n[t]||function(){throw new Error("Cannot find module '"+t+"'.")}()}var n={"./array":7,"./array.js":7,"./cookie":5,"./cookie.js":5,"./date":8,"./date.js":8,"./dom":3,"./dom.js":3,"./event":2,"./event.js":2,"./extensions/advancedGrid/adapterEzEditTable":25,"./extensions/advancedGrid/adapterEzEditTable.js":25,"./extensions/advancedGrid/advancedGrid":26,"./extensions/advancedGrid/advancedGrid.js":26,"./extensions/colsVisibility/colsVisibility":27,"./extensions/colsVisibility/colsVisibility.js":27,"./extensions/sort/adapterSortabletable":28,"./extensions/sort/adapterSortabletable.js":28,"./extensions/sort/sort":29,"./extensions/sort/sort.js":29,"./helpers":9,"./helpers.js":9,"./modules/alternateRows":22,"./modules/alternateRows.js":22,"./modules/checkList":16,"./modules/checkList.js":16,"./modules/clearButton":20,"./modules/clearButton.js":20,"./modules/colOps":23,"./modules/colOps.js":23,"./modules/dropdown":15,"./modules/dropdown.js":15,"./modules/gridLayout":11,"./modules/gridLayout.js":11,"./modules/help":21,"./modules/help.js":21,"./modules/highlightKeywords":13,"./modules/highlightKeywords.js":13,"./modules/loader":12,"./modules/loader.js":12,"./modules/paging":19,"./modules/paging.js":19,"./modules/popupFilter":14,"./modules/popupFilter.js":14,"./modules/rowsCounter":17,"./modules/rowsCounter.js":17,"./modules/statusBar":18,"./modules/statusBar.js":18,"./modules/store":10,"./modules/store.js":10,"./sort":24,"./sort.js":24,"./string":4,"./string.js":4,"./types":6,"./types.js":6};i.keys=function(){return Object.keys(n)},i.resolve=r,t.exports=i,i.id=1},,,,,,,,,,,,,,,,,,,,,,,,function(t,e,s){"use strict";var i=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},r=function(){function t(t,e){for(var s=0;s0&&!s.startRow?void 0:s.startRow||e.refRow,s.base_path=s.base_path||e.basePath+"ezEditTable/";var r=s.editable,a=s.selectable;s.selection=a,a&&(s.default_selection=s.default_selection||"row"),s.active_cell_css=s.active_cell_css||"ezETSelectedCell";var o=0,h=0;if(a){var d=function(t,s,i){var r=t.Selection,n=function(i){if("row"===t.defaultSelection)r.SelectRowByIndex(i);else{t.ClearSelections();var n=s.cellIndex,l=e.tbl.rows[i];"both"===t.defaultSelection&&r.SelectRowByIndex(i),l&&r.SelectCell(l.cells[n])}if(e.validRowsIndex.length!==e.getRowsNb()){var a=e.tbl.rows[i];a&&a.scrollIntoView(!1),u&&(u.cellIndex===e.getCellsNb()-1&&e.gridLayout?e.tblCont.scrollLeft=1e8:0===u.cellIndex&&e.gridLayout?e.tblCont.scrollLeft=0:u.scrollIntoView(!1))}};if(e.validRowsIndex){var a,d=e.validRowsIndex,c=d.length,p="row"!==t.defaultSelection?s.parentNode:s,u="TD"===s.nodeName?s:null,f=void 0!==i?t.Event.GetKey(i):0,g=l.Arr.has(d,p.rowIndex),v=34===f||33===f?e.Cpt.paging.pagingLength||t.nbRowsPerPage:1;if(g)34!==f&&33!==f?(o=l.Arr.indexByValue(d,p.rowIndex),h=p.rowIndex):(a=34===f?c-1>=o+v?d[o+v]:[c-1]:o-v<=d[0]?d[0]:d[o-v],h=a,o=l.Arr.indexByValue(d,a),n(a));else{if(p.rowIndex>h)if(p.rowIndex>=d[c-1])a=d[c-1];else{var m=o+v;a=m>c-1?d[c-1]:d[m]}else if(p.rowIndex<=d[0])a=d[0];else{var b=d[o-v];a=b?b:d[0]}h=p.rowIndex,n(a)}}},c=function(t,s){var i="row"!==t.defaultSelection?s.parentNode:s;if(e.paging&&e.Cpt.paging.nbPages>1){var r=e.Cpt.paging;t.nbRowsPerPage=r.pagingLength;var n=e.validRowsIndex,l=n.length,a=parseInt(r.startPagingRow,10)+parseInt(r.pagingLength,10),o=i.rowIndex;o===n[l-1]&&r.currentPageNb!==r.nbPages?r.setPage("last"):o==n[0]&&1!==r.currentPageNb?r.setPage("first"):o>n[a-1]&&on[0]&&r.setPage("previous")}};if(e.paging&&(e.Cpt.paging.onAfterChangePage=function(t){var e=t.ExtRegistry.ezEditTable,s=e.Selection,i=s.GetActiveRow();i&&i.scrollIntoView(!1);var r=s.GetActiveCell();r&&r.scrollIntoView(!1)}),"row"===s.default_selection){var p=s.on_before_selected_row;s.on_before_selected_row=function(){c(arguments[0],arguments[1],arguments[2]),p&&p.call(null,arguments[0],arguments[1],arguments[2])};var u=s.on_after_selected_row;s.on_after_selected_row=function(){d(arguments[0],arguments[1],arguments[2]),u&&u.call(null,arguments[0],arguments[1],arguments[2])}}else{var f=s.on_before_selected_cell;s.on_before_selected_cell=function(){c(arguments[0],arguments[1],arguments[2]),f&&f.call(null,arguments[0],arguments[1],arguments[2])};var g=s.on_after_selected_cell;s.on_after_selected_cell=function(){d(arguments[0],arguments[1],arguments[2]),g&&g.call(null,arguments[0],arguments[1],arguments[2])}}}if(r){var v=s.on_added_dom_row;if(s.on_added_dom_row=function(){e.nbFilterableRows++,e.paging?(e.nbRows++,e.nbVisibleRows++,e.nbFilterableRows++,e.paging=!1,e.Cpt.paging.destroy(),e.Cpt.paging.addPaging()):e.Cpt.rowsCounter.refresh(),e.alternateBgs&&e.Cpt.alternateRows.init(),v&&v.call(null,arguments[0],arguments[1],arguments[2])},s.actions&&s.actions["delete"]){var m=s.actions["delete"].on_after_submit;s.actions["delete"].on_after_submit=function(){e.nbFilterableRows--,e.paging?(e.nbRows--,e.nbVisibleRows--,e.nbFilterableRows--,e.paging=!1,e.Cpt.paging.destroy(),e.Cpt.paging.addPaging(!1)):e.Cpt.rowsCounter.refresh(),e.alternateBgs&&e.Cpt.alternateRows.init(),m&&m.call(null,arguments[0],arguments[1])}}}try{this._ezEditTable=new EditTable(e.id,s,t),this._ezEditTable.Init()}catch(b){throw new Error(this.err)}}},{key:"reset",value:function(){var t=this._ezEditTable;t&&(this.cfg.selectable&&t.Selection.Set(),this.cfg.editable&&t.Editable.Set())}},{key:"destroy",value:function(){var t=this._ezEditTable;t&&(this.cfg.selectable&&(t.Selection.ClearSelections(),t.Selection.Remove()),this.cfg.editable&&t.Editable.Remove())}}]),t}();e["default"]=a,t.exports=e["default"]},function(t,e,s){"use strict";var i=function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(e,"__esModule",{value:!0});var r=s(25),n=i(r);e["default"]=n["default"],t.exports=e["default"]},function(t,e,s){"use strict";var i=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},r=function(){function t(t,e){for(var s=0;s0,this.onLoaded=l.Types.isFn(r.on_loaded)?r.on_loaded:null,this.onBeforeOpen=l.Types.isFn(r.on_before_open)?r.on_before_open:null,this.onAfterOpen=l.Types.isFn(r.on_after_open)?r.on_after_open:null,this.onBeforeClose=l.Types.isFn(r.on_before_close)?r.on_before_close:null,this.onAfterClose=l.Types.isFn(r.on_after_close)?r.on_after_close:null,this.onBeforeColHidden=l.Types.isFn(r.on_before_col_hidden)?r.on_before_col_hidden:null,this.onAfterColHidden=l.Types.isFn(r.on_after_col_hidden)?r.on_after_col_hidden:null,this.onBeforeColDisplayed=l.Types.isFn(r.on_before_col_displayed)?r.on_before_col_displayed:null,this.onAfterColDisplayed=l.Types.isFn(r.on_after_col_displayed)?r.on_after_col_displayed:null,e.gridLayout&&(this.headersTbl=e.Cpt.gridLayout.headTbl,this.headersIndex=0,this.onAfterColDisplayed=function(){},this.onAfterColHidden=function(){}),e["import"](r.name+"Style",e.basePath+this.stylesheet,null,"link"),this.tf=e}return r(t,[{key:"toggle",value:function(){var t=this.contEl.style.display,e=this.onBeforeOpen,s=this.onBeforeClose,i=this.onAfterOpen,r=this.onAfterClose;e&&"inline"!==t&&e.call(null,this),s&&"inline"===t&&s.call(null,this),this.contEl.style.display="inline"===t?"none":"inline",i&&"inline"!==t&&i.call(null,this),r&&"inline"===t&&r.call(null,this)}},{key:"checkItem",value:function(t){var e=t.parentNode;if(e&&t){var s=t.firstChild.checked,i=t.firstChild.getAttribute("id").split("_")[1];i=parseInt(i,10),s?n.Dom.addClass(e,this.listSlcItemCssClass):n.Dom.removeClass(e,this.listSlcItemCssClass);var r=!1;(this.tickToHide&&s||!this.tickToHide&&!s)&&(r=!0),this.setHidden(i,r)}}},{key:"init",value:function(){this.manager&&(this.buildBtn(),this.buildManager(),this.initialized=!0)}},{key:"buildBtn",value:function(){var t=this;if(!this.btnEl){var e=this.tf,s=n.Dom.create("span",["id",this.prfx+e.id]);s.className=this.spanCssClass,this.btnTgtId||e.setToolbar();var i=this.btnTgtId?n.Dom.id(this.btnTgtId):e.rDiv;if(this.btnTgtId)i.appendChild(s);else{var r=i.firstChild;r.parentNode.insertBefore(s,r)}if(this.btnHtml){s.innerHTML=this.btnHtml;var l=s.firstChild;this.enableHover?a.Event.add(l,"mouseover",function(e){t.toggle(e)}):a.Event.add(l,"click",function(e){t.toggle(e)})}else{var o=n.Dom.create("a",["href","javascript:;"]);o.className=this.btnCssClass,o.title=this.extDesc,o.innerHTML=this.btnText,s.appendChild(o),this.enableHover?a.Event.add(o,"mouseover",function(e){t.toggle(e)}):a.Event.add(o,"click",function(e){t.toggle(e)})}this.spanEl=s,this.btnEl=this.spanEl.firstChild,this.onLoaded&&this.onLoaded.call(null,this)}}},{key:"buildManager",value:function(){var t=this,e=this.tf,s=this.contElTgtId?n.Dom.id(this.contElTgtId):n.Dom.create("div",["id",this.prfxCont+e.id]);s.className=this.contCssClass;var i=n.Dom.create("p");i.innerHTML=this.text,s.appendChild(i);var r=n.Dom.create("ul",["id","ul"+this.extName+"_"+e.id]);r.className=this.listCssClass;var l=this.headersTbl?this.headersTbl:e.tbl,o=this.headersTbl?this.headersIndex:e.getHeadersRowIndex(),h=l.rows[o];if(this.enableTickAll){var d=n.Dom.createCheckItem("col__"+e.id,this.tickAllText,this.tickAllText);n.Dom.addClass(d,this.listItemCssClass),r.appendChild(d),d.check.checked=!this.tickToHide,a.Event.add(d.check,"click",function(){for(var t=0;ti.length;)i="0"+i;e[s]=i}return e.join(".")}function c(t,e){var s=d(t.value.toLowerCase()),i=d(e.value.toLowerCase());return s==i?0:i>s?-1:1}var p=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},u=function(){function t(t,e){for(var s=0;se;e++);return e},SortableTable.prototype.initHeader=function(s){var i=this;if(i.tHead){i.headersRow=e.headersRow;var r=i.tHead.rows[i.headersRow].cells;i.sortTypes=s||[];for(var n,l,a=r.length,o=0;a>o;o++)l=r[o],null!==i.sortTypes[o]&&"None"!==i.sortTypes[o]?(l.style.cursor="pointer",n=g.Dom.create("img",["src",t.sortImgPath+t.sortImgBlank]),l.appendChild(n),null!==i.sortTypes[o]&&l.setAttribute("_sortType",i.sortTypes[o]),m.Event.add(l,"click",i._headerOnclick)):(l.setAttribute("_sortType",s[o]),l._sortType="None");i.updateHeaderArrows()}},SortableTable.prototype.updateHeaderArrows=function(){var s,i,r,n=this;if(e.sortConfig.asyncSort&&null!==e.sortConfig.triggerIds){var l=e.sortConfig.triggerIds;s=[],i=l.length;for(var a=0;ao;o++){var h=s[o].getAttribute("_sortType");null!==h&&"None"!==h&&(r=s[o].lastChild||s[o],"img"!==r.nodeName.toLowerCase()&&(r=g.Dom.create("img",["src",t.sortImgPath+t.sortImgBlank]),s[o].appendChild(r)),o===n.sortColumn?r.className=t.sortImgClassName+" "+(this.descending?t.sortImgDescClassName:t.sortImgAscClassName):r.className=t.sortImgClassName)}},SortableTable.prototype.getRowValue=function(t,e,s){var i=this,r=i._sortTypeInfo[e];if(r&&r.getRowValue)return r.getRowValue(t,s);var n=t.cells[s],l=SortableTable.getInnerText(n);return i.getValueFromString(l,e)},SortableTable.getInnerText=function(e){return e?e.getAttribute(t.sortCustomKey)?e.getAttribute(t.sortCustomKey):g.Dom.getText(e):void 0}}},{key:"addSortType",value:function(){SortableTable.prototype.addSortType(arguments[0],arguments[1],arguments[2],arguments[3])}},{key:"setSortTypes",value:function(){for(var t=this,e=this.tf,s=e.sortConfig,n=s.sortTypes,p=[],u=0;u 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'; -}]); \ No newline at end of file +},function(t,e,s){t.exports=function(t){"function"==typeof execScript?execScript(t):eval.call(null,t)}}]); \ No newline at end of file diff --git a/dist/tablefilter/tablefilter.js b/dist/tablefilter/tablefilter.js index 5bf2972a..42af7351 100644 --- a/dist/tablefilter/tablefilter.js +++ b/dist/tablefilter/tablefilter.js @@ -1,4 +1,4 @@ -!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var s=e();for(var i in s)("object"==typeof exports?exports:t)[i]=s[i]}}(this,function(){return function(t){function e(s){if(i[s])return i[s].exports;var l=i[s]={exports:{},id:s,loaded:!1};return t[s].call(l.exports,l,l.exports,e),l.loaded=!0,l.exports}var s=window.webpackJsonp;window.webpackJsonp=function(i,r){for(var a,n,o=0,h=[];o1)for(var s=0;s1?this.filtersRowIndex=this.headersRow+1:(this.filtersRowIndex=1,this.headersRow=0)),this.fltCellTag="th"!==h.filters_cell_tag||"td"!==h.filters_cell_tag?"td":h.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.tblData=[],this.validRowsIndex=null,this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.contDiv=null,this.infDivCssClass=h.inf_div_css_class||"inf",this.lDivCssClass=h.left_div_css_class||"ldiv",this.rDivCssClass=h.right_div_css_class||"rdiv",this.mDivCssClass=h.middle_div_css_class||"mdiv",this.contDivCssClass=h.content_div_css_class||"cont",this.stylesheet=h.stylesheet||this.basePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=h.flts_row_css_class||"fltrow",this.enableIcons=h.enable_icons===!1?!1:!0,this.alternateBgs=h.alternate_rows===!0?!0:!1,this.hasColWidth=h.col_width===!0?!0:!1,this.colWidth=this.hasColWidth?h.col_width:null,this.fixedHeaders=h.fixed_headers===!0?!0:!1,this.tBodyH=isNaN(h.tbody_height)?200:h.tbody_height,this.fltCssClass=h.flt_css_class||"flt",this.fltMultiCssClass=h.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=h.flt_small_css_class||"flt_s",this.singleFltCssClass=h.single_flt_css_class||"single_flt",this.isStartBgAlternate=!0,this.enterKey=h.enter_key===!1?!1:!0,this.onBeforeFilter=p.Types.isFn(h.on_before_filter)?h.on_before_filter:null,this.onAfterFilter=p.Types.isFn(h.on_after_filter)?h.on_after_filter:null,this.matchCase=h.match_case===!0?!0:!1,this.exactMatch=h.exact_match===!0?!0:!1,this.linkedFilters=h.linked_filters===!0?!0:!1,this.disableExcludedOptions=h.disable_excluded_options===!0?!0:!1,this.activeFlt=null,this.activeFilterId=null,this.hasColOperation=h.col_operation?!0:!1,this.colOperation=null,this.hasVisibleRows=h.rows_always_visible?!0:!1,this.visibleRows=this.hasVisibleRows?h.rows_always_visible:[],this.searchType=h.search_type||"include",this.isExternalFlt=h.external_flt_grid===!0?!0:!1,this.externalFltTgtIds=h.external_flt_grid_ids||null,this.externalFltEls=[],this.execDelay=isNaN(h.exec_delay)?100:parseInt(h.exec_delay,10),this.onFiltersLoaded=p.Types.isFn(h.on_filters_loaded)?h.on_filters_loaded:null,this.singleSearchFlt=h.single_search_filter===!0?!0:!1,this.onRowValidated=p.Types.isFn(h.on_row_validated)?h.on_row_validated:null,this.customCellDataCols=h.custom_cell_data_cols?h.custom_cell_data_cols:[],this.customCellData=p.Types.isFn(h.custom_cell_data)?h.custom_cell_data:null,this.watermark=h.watermark||"",this.isWatermarkArray=p.Types.isArray(this.watermark),this.toolBarTgtId=h.toolbar_target_id||null,this.helpInstructions=h.help_instructions||!1,this.popUpFilters=h.popup_filters===!0?!0:!1,this.markActiveColumns=h.mark_active_columns===!0?!0:!1,this.activeColumnsCssClass=h.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=p.Types.isFn(h.on_before_active_column)?h.on_before_active_column:null,this.onAfterActiveColumn=p.Types.isFn(h.on_after_active_column)?h.on_after_active_column:null,this.displayAllText=h.display_all_text||"",this.enableEmptyOption=h.enable_empty_option===!0?!0:!1,this.emptyText=h.empty_text||"(Empty)",this.enableNonEmptyOption=h.enable_non_empty_option===!0?!0:!1,this.nonEmptyText=h.non_empty_text||"(Non empty)",this.onSlcChange=h.on_change===!1?!1:!0,this.sortSlc=h.sort_select===!1?!1:!0,this.isSortNumAsc=h.sort_num_asc===!0?!0:!1,this.sortNumAsc=this.isSortNumAsc?h.sort_num_asc:null,this.isSortNumDesc=h.sort_num_desc===!0?!0:!1,this.sortNumDesc=this.isSortNumDesc?h.sort_num_desc:null,this.fillSlcOnDemand=h.fill_slc_on_demand===!0?!0:!1,this.hasCustomSlcOptions=p.Types.isObj(h.custom_slc_options)?!0:!1,this.customSlcOptions=p.Types.isArray(h.custom_slc_options)?h.custom_slc_options:null,this.rgxOperator=h.regexp_operator||"rgx:",this.emOperator=h.empty_operator||"[empty]",this.nmOperator=h.nonempty_operator||"[nonempty]",this.orOperator=h.or_operator||"||",this.anOperator=h.and_operator||"&&",this.grOperator=h.greater_operator||">",this.lwOperator=h.lower_operator||"<",this.leOperator=h.lower_equal_operator||"<=",this.geOperator=h.greater_equal_operator||">=",this.dfOperator=h.different_operator||"!",this.lkOperator=h.like_operator||"*",this.eqOperator=h.equal_operator||"=",this.stOperator=h.start_with_operator||"{",this.enOperator=h.end_with_operator||"}",this.curExp=h.cur_exp||"^[¥£€$]",this.separator=h.separator||",",this.rowsCounter=h.rows_counter===!0?!0:!1,this.statusBar=h.status_bar===!0?!0:!1,this.loader=h.loader===!0?!0:!1,this.displayBtn=h.btn===!0?!0:!1,this.btnText=h.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=h.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=h.btn_reset===!0?!0:!1,this.btnResetCssClass=h.btn_reset_css_class||"reset",this.onBeforeReset=p.Types.isFn(h.on_before_reset)?h.on_before_reset:null,this.onAfterReset=p.Types.isFn(h.on_after_reset)?h.on_after_reset:null,this.paging=h.paging===!0?!0:!1,this.nbVisibleRows=0,this.nbHiddenRows=0,this.sort=h.sort===!0?!0:!1,this.isSortEnabled=!1,this.sortConfig=h.sort_config||{},this.sortConfig.name=this.sortConfig.name||"sort",this.sortConfig.path=this.sortConfig.path||null,this.sortConfig.sortTypes=p.Types.isArray(this.sortConfig.sort_types)?this.sortConfig.sort_types:[],this.sortConfig.sortCol=this.sortConfig.sort_col||null,this.sortConfig.asyncSort=this.sortConfig.async_sort===!0?!0:!1,this.sortConfig.triggerIds=p.Types.isArray(this.sortConfig.sort_trigger_ids)?this.sortConfig.sort_trigger_ids:[],this.onKeyUp=h.on_keyup===!0?!0:!1,this.onKeyUpDelay=isNaN(h.on_keyup_delay)?900:h.on_keyup_delay,this.isUserTyping=null,this.onKeyUpTimer=void 0,this.highlightKeywords=h.highlight_keywords===!0?!0:!1,this.defaultDateType=h.default_date_type||"DMY",this.thousandsSeparator=h.thousands_separator||",",this.decimalSeparator=h.decimal_separator||".",this.hasColNbFormat=h.col_number_format===!0?!0:!1,this.colNbFormat=p.Types.isArray(this.hasColNbFormat)?h.col_number_format:null,this.hasColDateType=h.col_date_type===!0?!0:!1,this.colDateType=p.Types.isArray(this.hasColDateType)?h.col_date_type:null,this.msgFilter=h.msg_filter||"Filtering data...",this.msgPopulate=h.msg_populate||"Populating filter...",this.msgPopulateCheckList=h.msg_populate_checklist||"Populating list...",this.msgChangePage=h.msg_change_page||"Collecting paging data...",this.msgClear=h.msg_clear||"Clearing filters...",this.msgChangeResults=h.msg_change_results||"Changing results per page...",this.msgResetValues=h.msg_reset_grid_values||"Re-setting filters values...",this.msgResetPage=h.msg_reset_page||"Re-setting page...",this.msgResetPageLength=h.msg_reset_page_length||"Re-setting page length...",this.msgSort=h.msg_sort||"Sorting data...",this.msgLoadExtensions=h.msg_load_extensions||"Loading extensions...",this.msgLoadThemes=h.msg_load_themes||"Loading theme(s)...",this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=h.remember_grid_values===!0?!0:!1,this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&h.remember_page_number?!0:!1,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&h.remember_page_length?!0:!1,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=h.extensions,this.hasExtensions=p.Types.isArray(this.extensions),this.enableDefaultTheme=h.enable_default_theme===!0?!0:!1,this.hasThemes=h.enable_default_theme||p.Types.isArray(h.themes),this.themes=h.themes||[],this.themesPath=h.themes_path||this.basePath+"themes/",this.Cpt={loader:null,alternateRows:null,colOps:null,rowsCounter:null,gridLayout:null,store:null,highlightKeywords:null,paging:null,checkList:null,dropdown:null,popupFilter:null,clearButton:null,help:null,statusBar:null},this.ExtRegistry={sort:null,ezEditTable:null};var g=this;this.Evt={name:{filter:"Filter",dropdown:"dropdown",checklist:"checkList",changepage:"changePage",clear:"Clear",changeresultsperpage:"changeResults",resetvalues:"ResetValues",resetpage:"resetPage",resetpagelength:"resetPageLength",sort:"Sort",loadextensions:"LoadExtensions",loadthemes:"loadThemes"},detectKey:function(t){if(g.enterKey){var e=t||D.event;if(e){var s=e.Event.keyCode(e);13===s?(g._filter(),e.Event.cancel(e),e.Event.stop(e)):(g.isUserTyping=!0,D.clearInterval(g.onKeyUpTimer),g.onKeyUpTimer=void 0)}}},onKeyUp:function(t){function e(){D.clearInterval(g.onKeyUpTimer),g.onKeyUpTimer=void 0,g.isUserTyping||(g.filter(),g.isUserTyping=null)}if(g.onKeyUp){var s=t||D.event,i=s.Event.keyCode(s);g.isUserTyping=!1,13!==i&&9!==i&&27!==i&&38!==i&&40!==i?void 0===g.onKeyUpTimer&&(g.onKeyUpTimer=D.setInterval(e,g.onKeyUpDelay)):(D.clearInterval(g.onKeyUpTimer),g.onKeyUpTimer=void 0)}},onKeyDown:function(){g.onKeyUp&&(g.isUserTyping=!0)},onInpBlur:function(){g.onKeyUp&&(g.isUserTyping=!1,D.clearInterval(g.onKeyUpTimer))},onInpFocus:function(t){var e=t||D.event;g.activeFilterId=this.getAttribute("id"),g.activeFlt=n.Dom.id(g.activeFilterId),g.popUpFilters&&(e.Event.cancel(e),e.Event.stop(e))},onSlcFocus:function(t){var e=t||D.event;if(g.activeFilterId=this.getAttribute("id"),g.activeFlt=n.Dom.id(g.activeFilterId),g.fillSlcOnDemand&&"0"===this.getAttribute("filled")){var s=this.getAttribute("ct");g.Cpt.dropdown._build(s)}g.popUpFilters&&(e.Event.cancel(e),e.Event.stop(e))},onSlcChange:function(t){if(g.activeFlt){var e=t||D.event;g.popUpFilters&&e.Event.stop(e),g.onSlcChange&&g.filter()}},onCheckListClick:function(){if(g.fillSlcOnDemand&&"0"===this.getAttribute("filled")){var t=this.getAttribute("ct");g.Cpt.checkList._build(t),g.Cpt.checkList.checkListDiv[t].onclick=null,g.Cpt.checkList.checkListDiv[t].title=""}},onCheckListFocus:function(){g.activeFilterId=this.firstChild.getAttribute("id"),g.activeFlt=n.Dom.id(g.activeFilterId)},onBtnClick:function(){g.filter()}}}}return r(t,[{key:"init",value:function(){if(!this._hasGrid){this.tbl||(this.tbl=n.Dom.id(this.id)),this.gridLayout&&(this.refRow=null===this.startRow?0:this.startRow),this.popUpFilters&&(0===this.filtersRowIndex&&1===this.headersRow||this.gridLayout)&&(this.headersRow=0);var t,e=this.cfg,s=this.singleSearchFlt?1:this.nbCells;if(void 0===window["tf_"+this.id]&&(window["tf_"+this.id]=this),this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this._loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(this.Cpt.store=new f.Store(this)),this.gridLayout&&(this.Cpt.gridLayout=new g.GridLayout(this),this.Cpt.gridLayout.init()),this.loader&&(this.Cpt.loader||(this.Cpt.loader=new v.Loader(this))),this.highlightKeywords&&(this.Cpt.highlightKeyword=new m.HighlightKeyword(this)),this.popUpFilters&&(this.Cpt.popupFilter||(this.Cpt.popupFilter=new C.PopupFilter(this)),this.Cpt.popupFilter.init()),this.fltGrid)if(this.isFirstLoad){var i;if(!this.gridLayout){var l=n.Dom.tag(this.tbl,"thead");i=l.length>0?l[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&!this.popUpFilters&&this.headersRow++,this.popUpFilters&&this.headersRow++,i.className=this.fltsRowCssClass,!this.isExternalFlt||this.gridLayout&&!this.popUpFilters||(i.style.display="none")}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var r=0;s>r;r++){this.popUpFilters&&this.Cpt.popupFilter.build(r);var h=n.Dom.create(this.fltCellTag),p=this["col"+r],c=this.isExternalFlt&&this.externalFltTgtIds?this.externalFltTgtIds[r]:null;if(this.singleSearchFlt&&(h.colSpan=this.nbCells),this.gridLayout||i.appendChild(h),t=r==s-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,void 0===p&&(p=void 0===e["col_"+r]?this.fltTypeInp:o.Str.lower(e["col_"+r])),this.singleSearchFlt&&(p=this.fltTypeInp,t=this.singleFltCssClass),p===this.fltTypeSlc||p===this.fltTypeMulti){this.Cpt.dropdown||(this.Cpt.dropdown=new b.Dropdown(this));var d=this.Cpt.dropdown,u=n.Dom.create(this.fltTypeSlc,["id",this.prfxFlt+r+"_"+this.id],["ct",r],["filled","0"]);if(p===this.fltTypeMulti&&(u.multiple=this.fltTypeMulti,u.title=d.multipleSlcTooltip),u.className=o.Str.lower(p)===this.fltTypeSlc?t:this.fltMultiCssClass,c?(n.Dom.id(c).appendChild(u),this.externalFltEls.push(u)):h.appendChild(u),this.fltIds.push(this.prfxFlt+r+"_"+this.id),this.fillSlcOnDemand||d._build(r),a.Event.add(u,"keypress",this.Evt.detectKey),a.Event.add(u,"change",this.Evt.onSlcChange),a.Event.add(u,"focus",this.Evt.onSlcFocus),this.fillSlcOnDemand){var D=n.Dom.createOpt(this.displayAllText,"");u.appendChild(D)}}else if(p===this.fltTypeCheckList){var S;this.Cpt.checkList||(this.Cpt.checkList=new _.CheckList(this),S=this.Cpt.checkList);var F=n.Dom.create("div",["id",S.prfxCheckListDiv+r+"_"+this.id],["ct",r],["filled","0"]);F.className=S.checkListDivCssClass,c?(n.Dom.id(c).appendChild(F),this.externalFltEls.push(F)):h.appendChild(F),S.checkListDiv[r]=F,this.fltIds.push(this.prfxFlt+r+"_"+this.id),this.fillSlcOnDemand||S._build(r),this.fillSlcOnDemand&&(a.Event.add(F,"click",this.Evt.onCheckListClick),F.appendChild(n.Dom.text(S.activateCheckListTxt))),a.Event.add(F,"click",this.Evt.onCheckListFocus)}else{var P=p===this.fltTypeInp?"text":"hidden",E=n.Dom.create(this.fltTypeInp,["id",this.prfxFlt+r+"_"+this.id],["type",P],["ct",r]);if("hidden"!==P&&this.watermark&&E.setAttribute("placeholder",this.isWatermarkArray?this.watermark[r]||"":this.watermark),E.className=t,E.onfocus=this.Evt.onInpFocus,c?(n.Dom.id(c).appendChild(E),this.externalFltEls.push(E)):h.appendChild(E),this.fltIds.push(this.prfxFlt+r+"_"+this.id),E.onkeypress=this.Evt.detectKey,E.onkeydown=this.Evt.onKeyDown,E.onkeyup=this.Evt.onKeyUp,E.onblur=this.Evt.onInpBlur,this.rememberGridValues){var L=this.Cpt.store.getFilterValues(this.fltsValuesCookie);" "!=L[r]&&this.setFilterValue(r,L[r],!1)}}if(r==s-1&&this.displayBtn){var N=n.Dom.create(this.fltTypeInp,["id",this.prfxValButton+r+"_"+this.id],["type","button"],["value",this.btnText]);N.className=this.btnCssClass,c?n.Dom.id(c).appendChild(N):h.appendChild(N),N.onclick=this.Evt.onBtnClick}}}else this._resetGrid();else this.refRow=this.refRow-1,this.gridLayout&&(this.refRow=0),this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.nbFilterableRows+this.refRow;this.rowsCounter&&(this.Cpt.rowsCounter=new y.RowsCounter(this),this.Cpt.rowsCounter.init()),this.statusBar&&(this.Cpt.statusBar=new w.StatusBar(this),this.Cpt.statusBar.init()),(this.paging||this.Cpt.paging&&this.Cpt.paging.isPagingRemoved)&&(this.Cpt.paging=new x.Paging(this),this.Cpt.paging.init()),this.btnReset&&(this.Cpt.clearButton=new T.ClearButton(this),this.Cpt.clearButton.init()),this.helpInstructions&&(this.Cpt.help=new k.Help(this),this.Cpt.help.init()),this.hasColWidth&&!this.gridLayout&&this.setColWidths(),this.alternateBgs&&(this.Cpt.alternateRows=new I.AlternateRows(this),this.Cpt.alternateRows.init()),this.hasColOperation&&(this.Cpt.colOps=new R.ColOps(this),this.Cpt.colOps.calc()),this.sort&&this.importSort(),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||n.Dom.addClass(this.tbl,this.prfxTf),this.loader&&this.Cpt.loader.show("none"),this.hasExtensions&&this.initExtensions(),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this)}}},{key:"EvtManager",value:function(t){function e(){var e=this.Evt.name;switch(t){case e.filter:this._filter();break;case e.dropdown:this.linkedFilters?n.dropdown._build(i,!0):n.dropdown._build(i,!1,l,r);break;case e.checklist:n.checkList._build(i,l,r);break;case e.changepage:n.paging._changePage(a);break;case e.clear:this._clearFilters(),this._filter();break;case e.changeresultsperpage:n.paging._changeResultsPerPage();break;case e.resetvalues:this._resetValues(),this._filter();break;case e.resetpage:n.paging._resetPage(this.pgNbCookie);break;case e.resetpagelength:n.paging._resetPageLength(this.pgLenCookie);break;case e.sort:break;case e.loadextensions:this._loadExtensions();break;case e.loadthemes:this._loadThemes()}this.statusBar&&n.statusBar.message(""),this.loader&&n.loader.show("none")}var s=void 0===arguments[1]?{slcIndex:null,slcExternal:!1,slcId:null,pgIndex:null}:arguments[1],i=s.slcIndex,l=s.slcExternal,r=s.slcId,a=s.pgIndex,n=this.Cpt;this.loader||this.statusBar?(this.loader&&n.loader.show(""),this.statusBar&&n.statusBar.message(this["msg"+t]),D.setTimeout(e.bind(this),this.execDelay)):e.call(this)}},{key:"initExtensions",value:function(){for(var t=this.extensions,e=0;es;s++){var l=t[s],r=l.name,a=l.path;r&&!a?a=this.themesPath+r+"/"+r+".css":!r&&l.path&&(r="theme{0}".replace("{0}",s)),this.isImported(a,"link")||this["import"](r,a,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null}},{key:"destroy",value:function(){if(this._hasGrid){var t=this.tbl.rows,e=this.Cpt,s=this.ExtRegistry;this.paging&&e.paging.destroy(),this.statusBar&&e.statusBar.destroy(),this.rowsCounter&&e.rowsCounter.destroy(),this.btnReset&&e.clearButton.destroy(),this.helpInstructions&&e.help.destroy(),this.isExternalFlt&&!this.popUpFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&e.highlightKeyword.unhighlightAll(),this.sort&&s.sort.destroy(),this.loader&&e.loader.destroy(),this.popUpFilters&&e.popupFilter.destroy(),this.markActiveColumns&&this.clearActiveColumns(),s.advancedGrid&&s.advancedGrid.destroy();for(var i=this.refRow;is;s++){var i=t[s],l=n.Dom.id(i);l&&(l.innerHTML="")}}},{key:"importSort",value:function(){this.loadExtension({name:this.sortConfig.name,path:this.sortConfig.path})}},{key:"performSort",value:function(){this.EvtManager(this.Evt.name.sort)}},{key:"resetValues",value:function(){this.EvtManager(this.Evt.name.resetvalues)}},{key:"_resetValues",value:function(){this.rememberGridValues&&this.fillSlcOnDemand&&this._resetGridValues(this.fltsValuesCookie),this.rememberPageLen&&this.Cpt.paging&&this.Cpt.paging.resetPageLength(this.pgLenCookie),this.rememberPageNb&&this.Cpt.paging&&this.Cpt.paging.resetPage(this.pgNbCookie)}},{key:"_resetGridValues",value:function(t){if(this.fillSlcOnDemand){var e=this.Cpt.store.getFilterValues(t),s=this.getFiltersByType(this.fltTypeSlc,!0),i=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var l=0;lr):V?(n=F(t.replace(p,""),N),i=n>=r):j?(n=F(t.replace(d,""),N),i=r>=n):U?(n=F(t.replace(g,""),N),i=r>n):G?(n=F(t.replace(v,""),N),i=r.toString()!=n.toString()):K?(n=F(t.replace(C,""),N),i=r.toString()==n.toString()):m.test(t)?i=this._containsStr(t.replace(m,""),e,null,!1):S(t,N)?(n=F(t,N),i=r.toString()==n.toString()):B?i=o.Str.isEmpty(e):O&&(i=!o.Str.isEmpty(e));else if(this.hasColNbFormat&&this.colNbFormat[s]?(a=c(e,this.colNbFormat[s]),h=this.colNbFormat[s]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(a=c(e,"us"),h="us"):(a=c(e,"eu"),h="eu"),k)i=a<=c(t.replace(p,""),h);else if(R)i=a>=c(t.replace(d,""),h);else if(T)i=ac(t.replace(g,""),h);else if(D)i=this._containsStr(t.replace(v,""),e)?!1:!0;else if(E)i=this._containsStr(t.replace(m,""),e,null,!1);else if(P)i=this._containsStr(t.replace(C,""),e,null,!0);else if(L)i=0===e.indexOf(t.replace(b,""))?!0:!1;else if(A){var W=t.replace(_,"");i=e.lastIndexOf(W,e.length-1)===e.length-1-(W.length-1)&&e.lastIndexOf(W,e.length-1)>-1?!0:!1}else if(B)i=o.Str.isEmpty(e);else if(O)i=!o.Str.isEmpty(e);else if(H)try{var $=t.replace(x,""),q=new RegExp($);i=q.test(e)}catch(z){i=!1}else{var Y=l["col_"+s];i=this._containsStr(t,e,Y?Y:this.fltTypeInp)}return i}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this);var s=this.tbl.rows,i=this.Cpt,l=this.cfg,r=0;this.validRowsIndex=[],this.highlightKeywords&&i.highlightKeyword.unhighlightAll(),this.popUpFilters&&i.popupFilter.buildIcons(),this.markActiveColumns&&this.clearActiveColumns(),this.searchArgs=this.getFiltersValue();for(var a,h,p=new RegExp(this.leOperator),d=new RegExp(this.geOperator),f=new RegExp(this.lwOperator),g=new RegExp(this.grOperator),v=new RegExp(this.dfOperator),m=new RegExp(o.Str.rgxEsc(this.lkOperator)),C=new RegExp(this.eqOperator),b=new RegExp(this.stOperator),_=new RegExp(this.enOperator),y=this.emOperator,w=this.nmOperator,x=new RegExp(o.Str.rgxEsc(this.rgxOperator)),T=this.refRow;TE;E++){var L=this.searchArgs[this.singleSearchFlt?0:E],N=this.hasColDateType?this.colDateType[E]:this.defaultDateType;if(""!==L){var A=o.Str.matchCase(this.getCellData(E,k[E]),this.matchCase),B=L.split(this.orOperator),O=B.length>1?!0:!1,H=L.split(this.anOperator),M=H.length>1?!0:!1;if(O||M){for(var V,U=!1,j=O?B:H,G=0;Gd;d++)if(d===t&&""===i[r].style.display){var f=o.Str.lower(this.getCellData(d,n[d])),g=this.colNbFormat?this.colNbFormat[t]:null,v=e?u.Helpers.removeNbFormat(f,g):f;l.push(v)}}return l}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e,s=this.getFilterElement(t);if(!s)return"";var i=this.fltCol[t]; +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var s=e();for(var i in s)("object"==typeof exports?exports:t)[i]=s[i]}}(this,function(){return function(t){function e(s){if(i[s])return i[s].exports;var l=i[s]={exports:{},id:s,loaded:!1};return t[s].call(l.exports,l,l.exports,e),l.loaded=!0,l.exports}var s=window.webpackJsonp;window.webpackJsonp=function(i,r){for(var a,n,o=0,h=[];o1)for(var s=0;s1?this.filtersRowIndex=this.headersRow+1:(this.filtersRowIndex=1,this.headersRow=0)),this.fltCellTag="th"!==h.filters_cell_tag||"td"!==h.filters_cell_tag?"td":h.filters_cell_tag,this.fltIds=[],this.fltElms=[],this.searchArgs=null,this.tblData=[],this.validRowsIndex=null,this.fltGridEl=null,this.isFirstLoad=!0,this.infDiv=null,this.lDiv=null,this.rDiv=null,this.mDiv=null,this.contDiv=null,this.infDivCssClass=h.inf_div_css_class||"inf",this.lDivCssClass=h.left_div_css_class||"ldiv",this.rDivCssClass=h.right_div_css_class||"rdiv",this.mDivCssClass=h.middle_div_css_class||"mdiv",this.contDivCssClass=h.content_div_css_class||"cont",this.stylesheet=h.stylesheet||this.basePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=h.flts_row_css_class||"fltrow",this.enableIcons=h.enable_icons===!1?!1:!0,this.alternateBgs=h.alternate_rows===!0?!0:!1,this.hasColWidth=h.col_width===!0?!0:!1,this.colWidth=this.hasColWidth?h.col_width:null,this.fixedHeaders=h.fixed_headers===!0?!0:!1,this.tBodyH=isNaN(h.tbody_height)?200:h.tbody_height,this.fltCssClass=h.flt_css_class||"flt",this.fltMultiCssClass=h.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=h.flt_small_css_class||"flt_s",this.singleFltCssClass=h.single_flt_css_class||"single_flt",this.isStartBgAlternate=!0,this.enterKey=h.enter_key===!1?!1:!0,this.onBeforeFilter=p.Types.isFn(h.on_before_filter)?h.on_before_filter:null,this.onAfterFilter=p.Types.isFn(h.on_after_filter)?h.on_after_filter:null,this.matchCase=h.match_case===!0?!0:!1,this.exactMatch=h.exact_match===!0?!0:!1,this.linkedFilters=h.linked_filters===!0?!0:!1,this.disableExcludedOptions=h.disable_excluded_options===!0?!0:!1,this.activeFlt=null,this.activeFilterId=null,this.hasColOperation=h.col_operation?!0:!1,this.colOperation=null,this.hasVisibleRows=h.rows_always_visible?!0:!1,this.visibleRows=this.hasVisibleRows?h.rows_always_visible:[],this.searchType=h.search_type||"include",this.isExternalFlt=h.external_flt_grid===!0?!0:!1,this.externalFltTgtIds=h.external_flt_grid_ids||null,this.externalFltEls=[],this.execDelay=isNaN(h.exec_delay)?100:parseInt(h.exec_delay,10),this.onFiltersLoaded=p.Types.isFn(h.on_filters_loaded)?h.on_filters_loaded:null,this.singleSearchFlt=h.single_search_filter===!0?!0:!1,this.onRowValidated=p.Types.isFn(h.on_row_validated)?h.on_row_validated:null,this.customCellDataCols=h.custom_cell_data_cols?h.custom_cell_data_cols:[],this.customCellData=p.Types.isFn(h.custom_cell_data)?h.custom_cell_data:null,this.watermark=h.watermark||"",this.isWatermarkArray=p.Types.isArray(this.watermark),this.toolBarTgtId=h.toolbar_target_id||null,this.helpInstructions=h.help_instructions||!1,this.popUpFilters=h.popup_filters===!0?!0:!1,this.markActiveColumns=h.mark_active_columns===!0?!0:!1,this.activeColumnsCssClass=h.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=p.Types.isFn(h.on_before_active_column)?h.on_before_active_column:null,this.onAfterActiveColumn=p.Types.isFn(h.on_after_active_column)?h.on_after_active_column:null,this.displayAllText=h.display_all_text||"",this.enableEmptyOption=h.enable_empty_option===!0?!0:!1,this.emptyText=h.empty_text||"(Empty)",this.enableNonEmptyOption=h.enable_non_empty_option===!0?!0:!1,this.nonEmptyText=h.non_empty_text||"(Non empty)",this.onSlcChange=h.on_change===!1?!1:!0,this.sortSlc=h.sort_select===!1?!1:!0,this.isSortNumAsc=h.sort_num_asc===!0?!0:!1,this.sortNumAsc=this.isSortNumAsc?h.sort_num_asc:null,this.isSortNumDesc=h.sort_num_desc===!0?!0:!1,this.sortNumDesc=this.isSortNumDesc?h.sort_num_desc:null,this.fillSlcOnDemand=h.fill_slc_on_demand===!0?!0:!1,this.hasCustomSlcOptions=p.Types.isObj(h.custom_slc_options)?!0:!1,this.customSlcOptions=p.Types.isArray(h.custom_slc_options)?h.custom_slc_options:null,this.rgxOperator=h.regexp_operator||"rgx:",this.emOperator=h.empty_operator||"[empty]",this.nmOperator=h.nonempty_operator||"[nonempty]",this.orOperator=h.or_operator||"||",this.anOperator=h.and_operator||"&&",this.grOperator=h.greater_operator||">",this.lwOperator=h.lower_operator||"<",this.leOperator=h.lower_equal_operator||"<=",this.geOperator=h.greater_equal_operator||">=",this.dfOperator=h.different_operator||"!",this.lkOperator=h.like_operator||"*",this.eqOperator=h.equal_operator||"=",this.stOperator=h.start_with_operator||"{",this.enOperator=h.end_with_operator||"}",this.curExp=h.cur_exp||"^[¥£€$]",this.separator=h.separator||",",this.rowsCounter=h.rows_counter===!0?!0:!1,this.statusBar=h.status_bar===!0?!0:!1,this.loader=h.loader===!0?!0:!1,this.displayBtn=h.btn===!0?!0:!1,this.btnText=h.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=h.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=h.btn_reset===!0?!0:!1,this.btnResetCssClass=h.btn_reset_css_class||"reset",this.onBeforeReset=p.Types.isFn(h.on_before_reset)?h.on_before_reset:null,this.onAfterReset=p.Types.isFn(h.on_after_reset)?h.on_after_reset:null,this.paging=h.paging===!0?!0:!1,this.nbVisibleRows=0,this.nbHiddenRows=0,this.sort=h.sort===!0?!0:!1,this.isSortEnabled=!1,this.sortConfig=h.sort_config||{},this.sortConfig.name=this.sortConfig.name||"sort",this.sortConfig.path=this.sortConfig.path||null,this.sortConfig.sortTypes=p.Types.isArray(this.sortConfig.sort_types)?this.sortConfig.sort_types:[],this.sortConfig.sortCol=this.sortConfig.sort_col||null,this.sortConfig.asyncSort=this.sortConfig.async_sort===!0?!0:!1,this.sortConfig.triggerIds=p.Types.isArray(this.sortConfig.sort_trigger_ids)?this.sortConfig.sort_trigger_ids:[],this.onKeyUp=h.on_keyup===!0?!0:!1,this.onKeyUpDelay=isNaN(h.on_keyup_delay)?900:h.on_keyup_delay,this.isUserTyping=null,this.onKeyUpTimer=void 0,this.highlightKeywords=h.highlight_keywords===!0?!0:!1,this.defaultDateType=h.default_date_type||"DMY",this.thousandsSeparator=h.thousands_separator||",",this.decimalSeparator=h.decimal_separator||".",this.hasColNbFormat=h.col_number_format===!0?!0:!1,this.colNbFormat=p.Types.isArray(this.hasColNbFormat)?h.col_number_format:null,this.hasColDateType=h.col_date_type===!0?!0:!1,this.colDateType=p.Types.isArray(this.hasColDateType)?h.col_date_type:null,this.msgFilter=h.msg_filter||"Filtering data...",this.msgPopulate=h.msg_populate||"Populating filter...",this.msgPopulateCheckList=h.msg_populate_checklist||"Populating list...",this.msgChangePage=h.msg_change_page||"Collecting paging data...",this.msgClear=h.msg_clear||"Clearing filters...",this.msgChangeResults=h.msg_change_results||"Changing results per page...",this.msgResetValues=h.msg_reset_grid_values||"Re-setting filters values...",this.msgResetPage=h.msg_reset_page||"Re-setting page...",this.msgResetPageLength=h.msg_reset_page_length||"Re-setting page length...",this.msgSort=h.msg_sort||"Sorting data...",this.msgLoadExtensions=h.msg_load_extensions||"Loading extensions...",this.msgLoadThemes=h.msg_load_themes||"Loading theme(s)...",this.prfxTf="TF",this.prfxFlt="flt",this.prfxValButton="btn",this.prfxInfDiv="inf_",this.prfxLDiv="ldiv_",this.prfxRDiv="rdiv_",this.prfxMDiv="mdiv_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.hasStoredValues=!1,this.rememberGridValues=h.remember_grid_values===!0?!0:!1,this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&h.remember_page_number?!0:!1,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&h.remember_page_length?!0:!1,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=h.extensions,this.hasExtensions=p.Types.isArray(this.extensions),this.enableDefaultTheme=h.enable_default_theme===!0?!0:!1,this.hasThemes=h.enable_default_theme||p.Types.isArray(h.themes),this.themes=h.themes||[],this.themesPath=h.themes_path||this.basePath+"themes/",this.Cpt={loader:null,alternateRows:null,colOps:null,rowsCounter:null,gridLayout:null,store:null,highlightKeywords:null,paging:null,checkList:null,dropdown:null,popupFilter:null,clearButton:null,help:null,statusBar:null},this.ExtRegistry={sort:null,ezEditTable:null};var g=this;this.Evt={name:{filter:"Filter",dropdown:"dropdown",checklist:"checkList",changepage:"changePage",clear:"Clear",changeresultsperpage:"changeResults",resetvalues:"ResetValues",resetpage:"resetPage",resetpagelength:"resetPageLength",sort:"Sort",loadextensions:"LoadExtensions",loadthemes:"loadThemes"},detectKey:function(t){if(g.enterKey){var e=t||D.event;if(e){var s=e.Event.keyCode(e);13===s?(g._filter(),e.Event.cancel(e),e.Event.stop(e)):(g.isUserTyping=!0,D.clearInterval(g.onKeyUpTimer),g.onKeyUpTimer=void 0)}}},onKeyUp:function(t){function e(){D.clearInterval(g.onKeyUpTimer),g.onKeyUpTimer=void 0,g.isUserTyping||(g.filter(),g.isUserTyping=null)}if(g.onKeyUp){var s=t||D.event,i=s.Event.keyCode(s);g.isUserTyping=!1,13!==i&&9!==i&&27!==i&&38!==i&&40!==i?void 0===g.onKeyUpTimer&&(g.onKeyUpTimer=D.setInterval(e,g.onKeyUpDelay)):(D.clearInterval(g.onKeyUpTimer),g.onKeyUpTimer=void 0)}},onKeyDown:function(){g.onKeyUp&&(g.isUserTyping=!0)},onInpBlur:function(){g.onKeyUp&&(g.isUserTyping=!1,D.clearInterval(g.onKeyUpTimer))},onInpFocus:function(t){var e=t||D.event;g.activeFilterId=this.getAttribute("id"),g.activeFlt=n.Dom.id(g.activeFilterId),g.popUpFilters&&(e.Event.cancel(e),e.Event.stop(e))},onSlcFocus:function(t){var e=t||D.event;if(g.activeFilterId=this.getAttribute("id"),g.activeFlt=n.Dom.id(g.activeFilterId),g.fillSlcOnDemand&&"0"===this.getAttribute("filled")){var s=this.getAttribute("ct");g.Cpt.dropdown._build(s)}g.popUpFilters&&(e.Event.cancel(e),e.Event.stop(e))},onSlcChange:function(t){if(g.activeFlt){var e=t||D.event;g.popUpFilters&&e.Event.stop(e),g.onSlcChange&&g.filter()}},onCheckListClick:function(){if(g.fillSlcOnDemand&&"0"===this.getAttribute("filled")){var t=this.getAttribute("ct");g.Cpt.checkList._build(t),g.Cpt.checkList.checkListDiv[t].onclick=null,g.Cpt.checkList.checkListDiv[t].title=""}},onCheckListFocus:function(){g.activeFilterId=this.firstChild.getAttribute("id"),g.activeFlt=n.Dom.id(g.activeFilterId)},onBtnClick:function(){g.filter()}}}}return r(t,[{key:"init",value:function(){if(!this._hasGrid){this.tbl||(this.tbl=n.Dom.id(this.id)),this.gridLayout&&(this.refRow=null===this.startRow?0:this.startRow),this.popUpFilters&&(0===this.filtersRowIndex&&1===this.headersRow||this.gridLayout)&&(this.headersRow=0);var t,e=this.cfg,s=this.singleSearchFlt?1:this.nbCells;if(void 0===window["tf_"+this.id]&&(window["tf_"+this.id]=this),this["import"](this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this._loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(this.Cpt.store=new f.Store(this)),this.gridLayout&&(this.Cpt.gridLayout=new g.GridLayout(this),this.Cpt.gridLayout.init()),this.loader&&(this.Cpt.loader||(this.Cpt.loader=new v.Loader(this))),this.highlightKeywords&&(this.Cpt.highlightKeyword=new m.HighlightKeyword(this)),this.popUpFilters&&(this.Cpt.popupFilter||(this.Cpt.popupFilter=new C.PopupFilter(this)),this.Cpt.popupFilter.init()),this.fltGrid)if(this.isFirstLoad){var i;if(!this.gridLayout){var l=n.Dom.tag(this.tbl,"thead");i=l.length>0?l[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&!this.popUpFilters&&this.headersRow++,this.popUpFilters&&this.headersRow++,i.className=this.fltsRowCssClass,!this.isExternalFlt||this.gridLayout&&!this.popUpFilters||(i.style.display="none")}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var r=0;s>r;r++){this.popUpFilters&&this.Cpt.popupFilter.build(r);var h=n.Dom.create(this.fltCellTag),p=this["col"+r],c=this.isExternalFlt&&this.externalFltTgtIds?this.externalFltTgtIds[r]:null;if(this.singleSearchFlt&&(h.colSpan=this.nbCells),this.gridLayout||i.appendChild(h),t=r==s-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,void 0===p&&(p=void 0===e["col_"+r]?this.fltTypeInp:o.Str.lower(e["col_"+r])),this.singleSearchFlt&&(p=this.fltTypeInp,t=this.singleFltCssClass),p===this.fltTypeSlc||p===this.fltTypeMulti){this.Cpt.dropdown||(this.Cpt.dropdown=new b.Dropdown(this));var d=this.Cpt.dropdown,u=n.Dom.create(this.fltTypeSlc,["id",this.prfxFlt+r+"_"+this.id],["ct",r],["filled","0"]);if(p===this.fltTypeMulti&&(u.multiple=this.fltTypeMulti,u.title=d.multipleSlcTooltip),u.className=o.Str.lower(p)===this.fltTypeSlc?t:this.fltMultiCssClass,c?(n.Dom.id(c).appendChild(u),this.externalFltEls.push(u)):h.appendChild(u),this.fltIds.push(this.prfxFlt+r+"_"+this.id),this.fillSlcOnDemand||d._build(r),a.Event.add(u,"keypress",this.Evt.detectKey),a.Event.add(u,"change",this.Evt.onSlcChange),a.Event.add(u,"focus",this.Evt.onSlcFocus),this.fillSlcOnDemand){var D=n.Dom.createOpt(this.displayAllText,"");u.appendChild(D)}}else if(p===this.fltTypeCheckList){var S;this.Cpt.checkList||(this.Cpt.checkList=new _.CheckList(this),S=this.Cpt.checkList);var F=n.Dom.create("div",["id",S.prfxCheckListDiv+r+"_"+this.id],["ct",r],["filled","0"]);F.className=S.checkListDivCssClass,c?(n.Dom.id(c).appendChild(F),this.externalFltEls.push(F)):h.appendChild(F),S.checkListDiv[r]=F,this.fltIds.push(this.prfxFlt+r+"_"+this.id),this.fillSlcOnDemand||S._build(r),this.fillSlcOnDemand&&(a.Event.add(F,"click",this.Evt.onCheckListClick),F.appendChild(n.Dom.text(S.activateCheckListTxt))),a.Event.add(F,"click",this.Evt.onCheckListFocus)}else{var P=p===this.fltTypeInp?"text":"hidden",E=n.Dom.create(this.fltTypeInp,["id",this.prfxFlt+r+"_"+this.id],["type",P],["ct",r]);if("hidden"!==P&&this.watermark&&E.setAttribute("placeholder",this.isWatermarkArray?this.watermark[r]||"":this.watermark),E.className=t,E.onfocus=this.Evt.onInpFocus,c?(n.Dom.id(c).appendChild(E),this.externalFltEls.push(E)):h.appendChild(E),this.fltIds.push(this.prfxFlt+r+"_"+this.id),E.onkeypress=this.Evt.detectKey,E.onkeydown=this.Evt.onKeyDown,E.onkeyup=this.Evt.onKeyUp,E.onblur=this.Evt.onInpBlur,this.rememberGridValues){var L=this.Cpt.store.getFilterValues(this.fltsValuesCookie);" "!=L[r]&&this.setFilterValue(r,L[r],!1)}}if(r==s-1&&this.displayBtn){var N=n.Dom.create(this.fltTypeInp,["id",this.prfxValButton+r+"_"+this.id],["type","button"],["value",this.btnText]);N.className=this.btnCssClass,c?n.Dom.id(c).appendChild(N):h.appendChild(N),N.onclick=this.Evt.onBtnClick}}}else this._resetGrid();else this.refRow=this.refRow-1,this.gridLayout&&(this.refRow=0),this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.nbFilterableRows+this.refRow;this.rowsCounter&&(this.Cpt.rowsCounter=new y.RowsCounter(this),this.Cpt.rowsCounter.init()),this.statusBar&&(this.Cpt.statusBar=new w.StatusBar(this),this.Cpt.statusBar.init()),(this.paging||this.Cpt.paging&&this.Cpt.paging.isPagingRemoved)&&(this.Cpt.paging=new x.Paging(this),this.Cpt.paging.init()),this.btnReset&&(this.Cpt.clearButton=new T.ClearButton(this),this.Cpt.clearButton.init()),this.helpInstructions&&(this.Cpt.help=new k.Help(this),this.Cpt.help.init()),this.hasColWidth&&!this.gridLayout&&this.setColWidths(),this.alternateBgs&&(this.Cpt.alternateRows=new I.AlternateRows(this),this.Cpt.alternateRows.init()),this.hasColOperation&&(this.Cpt.colOps=new R.ColOps(this),this.Cpt.colOps.calc()),this.sort&&this.importSort(),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||n.Dom.addClass(this.tbl,this.prfxTf),this.loader&&this.Cpt.loader.show("none"),this.hasExtensions&&this.initExtensions(),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this)}}},{key:"EvtManager",value:function(t){function e(){var e=this.Evt.name;switch(t){case e.filter:this._filter();break;case e.dropdown:this.linkedFilters?n.dropdown._build(i,!0):n.dropdown._build(i,!1,l,r);break;case e.checklist:n.checkList._build(i,l,r);break;case e.changepage:n.paging._changePage(a);break;case e.clear:this._clearFilters(),this._filter();break;case e.changeresultsperpage:n.paging._changeResultsPerPage();break;case e.resetvalues:this._resetValues(),this._filter();break;case e.resetpage:n.paging._resetPage(this.pgNbCookie);break;case e.resetpagelength:n.paging._resetPageLength(this.pgLenCookie);break;case e.sort:break;case e.loadextensions:this._loadExtensions();break;case e.loadthemes:this._loadThemes()}this.statusBar&&n.statusBar.message(""),this.loader&&n.loader.show("none")}var s=void 0===arguments[1]?{slcIndex:null,slcExternal:!1,slcId:null,pgIndex:null}:arguments[1],i=s.slcIndex,l=s.slcExternal,r=s.slcId,a=s.pgIndex,n=this.Cpt;this.loader||this.statusBar?(this.loader&&n.loader.show(""),this.statusBar&&n.statusBar.message(this["msg"+t]),D.setTimeout(e.bind(this),this.execDelay)):e.call(this)}},{key:"initExtensions",value:function(){for(var t=this.extensions,e=0;es;s++){var l=t[s],r=l.name,a=l.path;r&&!a?a=this.themesPath+r+"/"+r+".css":!r&&l.path&&(r="theme{0}".replace("{0}",s)),this.isImported(a,"link")||this["import"](r,a,null,"link")}this.btnResetText=null,this.btnResetHtml='',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null}},{key:"destroy",value:function(){if(this._hasGrid){var t=this.tbl.rows,e=this.Cpt,s=this.ExtRegistry;this.paging&&e.paging.destroy(),this.statusBar&&e.statusBar.destroy(),this.rowsCounter&&e.rowsCounter.destroy(),this.btnReset&&e.clearButton.destroy(),this.helpInstructions&&e.help.destroy(),this.isExternalFlt&&!this.popUpFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&e.highlightKeyword.unhighlightAll(),this.sort&&s.sort.destroy(),this.loader&&e.loader.destroy(),this.popUpFilters&&e.popupFilter.destroy(),this.markActiveColumns&&this.clearActiveColumns(),s.advancedGrid&&s.advancedGrid.destroy();for(var i=this.refRow;is;s++){var i=t[s],l=n.Dom.id(i);l&&(l.innerHTML="")}}},{key:"importSort",value:function(){this.loadExtension({name:this.sortConfig.name,path:this.sortConfig.path})}},{key:"performSort",value:function(){this.EvtManager(this.Evt.name.sort)}},{key:"resetValues",value:function(){this.EvtManager(this.Evt.name.resetvalues)}},{key:"_resetValues",value:function(){this.rememberGridValues&&this.fillSlcOnDemand&&this._resetGridValues(this.fltsValuesCookie),this.rememberPageLen&&this.Cpt.paging&&this.Cpt.paging.resetPageLength(this.pgLenCookie),this.rememberPageNb&&this.Cpt.paging&&this.Cpt.paging.resetPage(this.pgNbCookie)}},{key:"_resetGridValues",value:function(t){if(this.fillSlcOnDemand){var e=this.Cpt.store.getFilterValues(t),s=this.getFiltersByType(this.fltTypeSlc,!0),i=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(e[e.length-1])===this.fltIds.length){for(var l=0;lr):V?(n=F(t.replace(p,""),N),i=n>=r):j?(n=F(t.replace(d,""),N),i=r>=n):U?(n=F(t.replace(g,""),N),i=r>n):G?(n=F(t.replace(v,""),N),i=r.toString()!=n.toString()):K?(n=F(t.replace(C,""),N),i=r.toString()==n.toString()):m.test(t)?i=this._containsStr(t.replace(m,""),e,null,!1):S(t,N)?(n=F(t,N),i=r.toString()==n.toString()):B?i=o.Str.isEmpty(e):O&&(i=!o.Str.isEmpty(e));else if(this.hasColNbFormat&&this.colNbFormat[s]?(a=c(e,this.colNbFormat[s]),h=this.colNbFormat[s]):","===this.thousandsSeparator&&"."===this.decimalSeparator?(a=c(e,"us"),h="us"):(a=c(e,"eu"),h="eu"),k)i=a<=c(t.replace(p,""),h);else if(R)i=a>=c(t.replace(d,""),h);else if(T)i=ac(t.replace(g,""),h);else if(D)i=this._containsStr(t.replace(v,""),e)?!1:!0;else if(E)i=this._containsStr(t.replace(m,""),e,null,!1);else if(P)i=this._containsStr(t.replace(C,""),e,null,!0);else if(L)i=0===e.indexOf(t.replace(b,""))?!0:!1;else if(A){var W=t.replace(_,"");i=e.lastIndexOf(W,e.length-1)===e.length-1-(W.length-1)&&e.lastIndexOf(W,e.length-1)>-1?!0:!1}else if(B)i=o.Str.isEmpty(e);else if(O)i=!o.Str.isEmpty(e);else if(H)try{var $=t.replace(x,""),q=new RegExp($);i=q.test(e)}catch(z){i=!1}else{var Y=l["col_"+s];i=this._containsStr(t,e,Y?Y:this.fltTypeInp)}return i}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this);var s=this.tbl.rows,i=this.Cpt,l=this.cfg,r=0;this.validRowsIndex=[],this.highlightKeywords&&i.highlightKeyword.unhighlightAll(),this.popUpFilters&&i.popupFilter.buildIcons(),this.markActiveColumns&&this.clearActiveColumns(),this.searchArgs=this.getFiltersValue();for(var a,h,p=new RegExp(this.leOperator),d=new RegExp(this.geOperator),f=new RegExp(this.lwOperator),g=new RegExp(this.grOperator),v=new RegExp(this.dfOperator),m=new RegExp(o.Str.rgxEsc(this.lkOperator)),C=new RegExp(this.eqOperator),b=new RegExp(this.stOperator),_=new RegExp(this.enOperator),y=this.emOperator,w=this.nmOperator,x=new RegExp(o.Str.rgxEsc(this.rgxOperator)),T=this.refRow;TE;E++){var L=this.searchArgs[this.singleSearchFlt?0:E],N=this.hasColDateType?this.colDateType[E]:this.defaultDateType;if(""!==L){var A=o.Str.matchCase(this.getCellData(E,k[E]),this.matchCase),B=L.split(this.orOperator),O=B.length>1?!0:!1,H=L.split(this.anOperator),M=H.length>1?!0:!1;if(O||M){for(var V,U=!1,j=O?B:H,G=0;Gd;d++)if(d===t&&""===i[r].style.display){var f=o.Str.lower(this.getCellData(d,n[d])),g=this.colNbFormat?this.colNbFormat[t]:null,v=e?u.Helpers.removeNbFormat(f,g):f;l.push(v)}}return l}}},{key:"getFilterValue",value:function(t){if(this.fltGrid){var e,s=this.getFilterElement(t);if(!s)return"";var i=this.fltCol[t]; if(i!==this.fltTypeMulti&&i!==this.fltTypeCheckList)e=s.value;else if(i===this.fltTypeMulti){e="";for(var l=0;l]+>/g,"");return e=e.replace(/^\s+/,"").replace(/\s+$/,"")},l.create=function(t){if(t&&""!==t){var e=document.createElement(t),s=arguments;if(s.length>1)for(var i=0;i0){var i=document.cookie,l=i.indexOf(s);if(-1!==l){l+=s.length;var r=i.indexOf(";",l);-1===r&&(r=i.length),e=unescape(i.substring(l,r))}}return e},i.remove=function(t){this.write(t,"",-1)},i.valueToArray=function(t,e){e||(e=",");var s=this.read(t),i=s.split(e);return i},i.getValueByIndex=function(t,e,s){s||(s=",");var i=this.valueToArray(t,s);return i[e]},e.Cookie=i},function(t,e,s){"use strict";var i={},l=void 0;i.isObj=function(t){var e=!1;return"string"==typeof t?window[t]&&"object"==typeof window[t]&&(e=!0):t&&"object"==typeof t&&(e=!0),e},i.isFn=function(t){return t&&t.constructor==Function},i.isArray=function(t){return t&&t.constructor==Array},i.isUndef=function(t){return t===l},e.Types=i},function(t,e,s){"use strict";var i=s(4),l={has:function(t,e,s){for(var l=void 0===s?!1:s,r=0;r2)return t;var e;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function l(t){if(void 0===t)return 0;for(var e,s=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],i=0;i11||23>e)&&(e-=12),1>e||e>12?0:e}var r={isValid:function(t,e){if(e||(e="DMY"),e=e.toUpperCase(),3!=e.length&&"DDMMMYYYY"===e){var s=this.format(t,e);t=s.getDate()+"/"+(s.getMonth()+1)+"/"+s.getFullYear(),e="DMY"}(-1===e.indexOf("M")||-1===e.indexOf("D")||-1===e.indexOf("Y"))&&(e="DMY");var i,l;if("Y"==e.substring(0,1)?(i=/^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/,l=/^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/):"Y"==e.substring(1,2)?(i=/^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/,l=/^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/):(i=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/,l=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/),i.test(t)===!1&&l.test(t)===!1)return!1;var r,a,n,o=t.split(RegExp.$1);r="M"===e.substring(0,1)?o[0]:"M"===e.substring(1,2)?o[1]:o[2],a="D"===e.substring(0,1)?o[0]:"D"===e.substring(1,2)?o[1]:o[2],n="Y"===e.substring(0,1)?o[0]:"Y"===e.substring(1,2)?o[1]:o[2],parseInt(n,10)<=50&&(n=(parseInt(n,10)+2e3).toString()),parseInt(n,10)<=99&&(n=(parseInt(n,10)+1900).toString());var h=new Date(parseInt(n,10),parseInt(r,10)-1,parseInt(a,10),0,0,0,0);return parseInt(a,10)!=h.getDate()?!1:parseInt(r,10)-1!=h.getMonth()?!1:!0},format:function(t){function e(e,s){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}(function(t,e){if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var s;switch(e.toUpperCase()){case"DDMMMYYYY":parts=t.replace(/[- \/.]/g," ").split(" "),s=new Date(i(parts[2]),l(parts[1])-1,parts[0]);break;case"DMY":parts=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),s=new Date(i(parts[2]),parts[1]-1,parts[0]);break;case"MDY":parts=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),s=new Date(i(parts[2]),parts[0]-1,parts[1]);break;case"YMD":parts=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),s=new Date(i(parts[0]),parts[1]-1,parts[2]);break;default:parts=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),s=new Date(i(parts[2]),parts[1]-1,parts[0])}return s})};e.DateHelper=r},function(t,e,s){"use strict";var i=s(4),l={isIE:function(){return/msie|MSIE/.test(navigator.userAgent)},removeNbFormat:function(t,e){if(t){e||(e="us");var s=t;return s="us"===i.Str.lower(e)?+s.replace(/[^\d\.-]/g,""):+s.replace(/[^\d\,-]/g,"").replace(",",".")}}};e.Helpers=l},function(t,e,s){"use strict";var i=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},l=function(){function t(t,e){for(var s=0;s0&&i.removeChild(I[0]),this.headTbl.style.tableLayout="fixed",i.style.tableLayout="fixed",this.headTbl.cellPadding=i.cellPadding,this.headTbl.cellSpacing=i.cellSpacing,e.setColWidths(),this.headTblCont.style.width=this.tblCont.clientWidth+"px",i.style.width="",this.headTbl.style.width=i.clientWidth+"px",n.Event.add(this.tblCont,"scroll",function(e){var s=n.Event.target(e),i=s.scrollLeft;t.headTblCont.scrollLeft=i}),s.sort!==!1&&(e.sort=!0,e.sortConfig.asyncSort=!0,e.sortConfig.triggerIds=v),this.gridEnableColResizer&&(e.hasExtensions?e._containsStr("colsresizer",Str.lower(e.extensions.src.toString()))||(e.extensions.name.push("ColumnsResizer_"+e.id),e.extensions.src.push(e.gridColResizerPath),e.extensions.description.push("Columns Resizing"),e.extensions.initialize.push(function(t){t.SetColsResizer("ColumnsResizer_"+t.id)})):(e.extensions={name:["ColumnsResizer_"+e.id],src:[this.gridColResizerPath],description:["Columns Resizing"],initialize:[function(t){t.SetColsResizer("ColumnsResizer_"+t.id)}]},e.hasExtensions=!0)),s.col_resizer_cols_headers_table=this.headTbl.getAttribute("id"),s.col_resizer_cols_headers_index=this.gridHeadRowIndex,s.col_resizer_width_adjustment=0,s.col_enable_text_ellipsis=!1,this.tblHasColTag=r.Dom.tag(i,"col").length>0?!0:!1;var R=function(t){if(t){for(var s=e.nbCells-1;s>=0;s--){var l=r.Dom.create("col",["id",e.id+"_col_"+s]);i.firstChild.parentNode.insertBefore(l,i.firstChild),l.style.width=e.colWidth[s],t.gridColElms[s]=l}t.tblHasColTag=!0}};if(this.tblHasColTag)for(var D=r.Dom.tag(i,"col"),S=0;S',this.popUpDivCssClass=s.popup_div_css_class||"popUpFilter",this.onBeforePopUpOpen=r.Types.isFn(s.on_before_popup_filter_open)?s.on_before_popup_filter_open:null,this.onAfterPopUpOpen=r.Types.isFn(s.on_after_popup_filter_open)?s.on_after_popup_filter_open:null,this.onBeforePopUpClose=r.Types.isFn(s.on_before_popup_filter_close)?s.on_before_popup_filter_close:null,this.onAfterPopUpClose=r.Types.isFn(s.on_after_popup_filter_close)?s.on_after_popup_filter_close:null,this.popUpFltSpans=[],this.popUpFltImgs=[],this.popUpFltElms=this.popUpFltElmCache||[],this.popUpFltAdjustToContainer=!0,this.prfxPopUpSpan="popUpSpan_",this.prfxPopUpDiv="popUpDiv_",this.tf=t}return l(e,[{key:"onClick",value:function(e){var s=e||t.event,i=s.target.parentNode,l=parseInt(i.getAttribute("ci"),10);if(this.closeAll(l),this.toggle(l),this.popUpFltAdjustToContainer){var r=this.popUpFltElms[l],h=this.tf.getHeaderElement(l),p=.95*h.clientWidth;if(o.Helpers.isIE()){var c=a.Dom.position(h).left;r.style.left=c+"px"}r.style.width=parseInt(p,10)+"px"}n.Event.cancel(s),n.Event.stop(s)}},{key:"init",value:function(){for(var t=this,e=this.tf,s=0;sRemove ezEditTable - + + diff --git a/src-es6/tablefilter.js b/src-es6/tablefilter.js index 02a73e17..eb87e0cf 100644 --- a/src-es6/tablefilter.js +++ b/src-es6/tablefilter.js @@ -2021,7 +2021,7 @@ export class TableFilter{ } if(!isRowValid){ - this.validateRow(k,false); + this.validateRow(k, false); // always visible rows need to be counted as valid if(this.hasVisibleRows && array.has(this.visibleRows, k) && !this.paging){ @@ -2030,13 +2030,13 @@ export class TableFilter{ hiddenrows++; } } else { - this.validateRow(k,true); + this.validateRow(k, true); this.validRowsIndex.push(k); if(this.alternateBgs){ Cpt.alternateRows.setRowBg(k, this.validRowsIndex.length); } if(this.onRowValidated){ - this.onRowValidated.call(null,this,k); + this.onRowValidated.call(null, this, k); } } }// for k @@ -2145,7 +2145,7 @@ export class TableFilter{ } /** - * Returns the filter value for a specified column index + * Return the filter's value of a specified column * @param {Number} index Column index * @return {String} Filter value */ @@ -2190,9 +2190,10 @@ export class TableFilter{ return fltValue; } - /*==================================================== - - Returns the value of every single filter - =====================================================*/ + /** + * Return the filters' values + * @return {Array} List of filters' values + */ getFiltersValue(){ if(!this.fltGrid){ return; @@ -2207,11 +2208,11 @@ export class TableFilter{ return searchArgs; } - /*==================================================== - - Returns filter id of a specified column - - Params: - - index: column index (numeric value) - =====================================================*/ + /** + * Return the ID of the filter of a specified column + * @param {Number} index Column's index + * @return {String} ID of the filter element + */ getFilterId(index){ if(!this.fltGrid){ return; @@ -2219,16 +2220,15 @@ export class TableFilter{ return this.fltIds[index]; } - /*==================================================== - - returns an array containing ids of filters of a - specified type (inputs or selects) - - Note that hidden filters are also returned - - Needs folllowing args: - - filter type string ('input','select', - 'multiple') - - optional boolean: if set true method - returns column indexes otherwise filters ids - =====================================================*/ + /** + * Return the list of ids of filters matching a specified type. + * Note: hidden filters are also returned + * + * @param {String} type Filter type string ('input', 'select', 'multiple', + * 'checklist') + * @param {Boolean} bool If true returns columns indexes instead of IDs + * @return {[type]} List of element IDs or column indexes + */ getFiltersByType(type, bool){ if(!this.fltGrid){ return; @@ -2244,34 +2244,32 @@ export class TableFilter{ return arr; } - /*==================================================== - - returns filter DOM element for a given column - index - =====================================================*/ + /** + * Return the filter's DOM element for a given column + * @param {Number} index Column's index + * @return {DOMElement} + */ getFilterElement(index){ - if(!this.fltGrid){ - return null; - } - return dom.id(this.fltIds[index]); + var fltId = this.fltIds[index]; + return dom.id(fltId); } - /*==================================================== - - returns number of cells in a row - - if rowIndex param is passed returns number of - cells of specified row (number) - =====================================================*/ + /** + * Return the number of cells for a given row index + * @param {Number} rowIndex Index of the row + * @return {Number} Number of cells + */ getCellsNb(rowIndex){ var tr = !rowIndex ? this.tbl.rows[0] : this.tbl.rows[rowIndex]; return tr.cells.length; } - /*==================================================== - - returns total nb of filterable rows starting - from reference row if defined - - Param: - - includeHeaders: if true header rows are - included in calculation(= table rows number) - =====================================================*/ + /** + * Return the number of filterable rows starting from reference row if + * defined + * @param {Boolean} includeHeaders Include the headers row + * @return {Number} Number of filterable rows + */ getRowsNb(includeHeaders){ var s = !this.refRow ? 0 : this.refRow, ntrs = this.tbl.rows.length; @@ -2279,28 +2277,32 @@ export class TableFilter{ return parseInt(ntrs-s, 10); } - /*==================================================== - - returns text content of a given cell - - Params: - - i: index of the column (number) - - cell: td DOM object - =====================================================*/ + /** + * Return the data of a given cell + * @param {Number} i Column's index + * @param {Object} cell Cell's DOM object + * @return {String} + */ getCellData(i, cell){ if(i===undefined || !cell){ return ''; } //First checks for customCellData event if(this.customCellData && array.has(this.customCellDataCols, i)){ - return this.customCellData.call(null,this,cell,i); + return this.customCellData.call(null, this, cell, i); } else { return dom.getText(cell); } } - /*==================================================== - - returns an array containing table data: - [rowindex,[value1,value2,value3...]] - =====================================================*/ + /** + * Return the table data with following format: + * [ + * [rowIndex, [value0, value1...]], + * [rowIndex, [value0, value1...]] + * ] + * @return {Array} + */ getTableData(){ var row = this.tbl.rows; for(var k=this.refRow; k