diff --git a/.jshintrc b/.jshintrc index 8fcd9aac..2863270e 100644 --- a/.jshintrc +++ b/.jshintrc @@ -11,14 +11,14 @@ // Reserved words "-W024": true, "curly": true, - //"indent": 4, + "indent": 4, //"eqeqeq": true, "es3": true, "esnext": true, + "unused": true, //"maxlen" : 80, "globals": { - "System": true, "Object": true, "module": true, "require": true, diff --git a/Gruntfile.js b/Gruntfile.js index 86040c2b..337c2584 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -2,8 +2,12 @@ module.exports = function (grunt) { var webpack = require('webpack'); var webpackConfig = require('./webpack.config.js'); - var pkg = grunt.file.readJSON('package.json'); - var version = pkg.version; + var fs = require('fs'); + var path = require('path'); + // var pkg = grunt.file.readJSON('package.json'); + // var version = pkg.version; + var testDir = 'test'; + var testHost = 'http://localhost:8080/'; grunt.initConfig({ @@ -18,7 +22,18 @@ module.exports = function (grunt) { }, qunit: { - files: ['test/**/*.html'] + // files: ['test/**/*.html'], + // urls: ['http://localhost:9000/test/test.html'] + all: { + options: { + urls: getTestFiles(testDir, testHost) + } + }, + only: { + options: { + urls: [] + } + } }, copy: { @@ -39,7 +54,7 @@ module.exports = function (grunt) { 'webpack-dev-server': { options: { webpack: webpack.dev, - publicPath: '/dev/' + publicPath: '/build/' }, start: { keepAlive: true, @@ -96,7 +111,7 @@ module.exports = function (grunt) { expand: true, cwd: 'src-es6', src: ['**/*.js'], - dest: 'dev/tablefilter' + dest: 'build/tablefilter' }] } } @@ -110,21 +125,86 @@ module.exports = function (grunt) { grunt.loadNpmTasks('grunt-babel'); // The development server (the recommended option for development) - grunt.registerTask('dev-server', ['webpack-dev-server:start']); + grunt.registerTask('server', ['webpack-dev-server:start']); // Build and watch cycle (another option for development) // Advantage: No server required, can run app from filesystem // Disadvantage: Requests are not blocked until bundle is available, // can serve an old app on too fast refresh - grunt.registerTask('dev', ['jshint', 'webpack:build', 'copy:build'/*, 'watch:app'*/]); + grunt.registerTask('dev', ['jshint', 'webpack:build', 'copy:build']); // Production build grunt.registerTask('dist', ['jshint', 'webpack:dist', 'copy:dist']); - // Tests - grunt.registerTask('test', ['qunit']); - // Transpile with Babel grunt.registerTask('transpile', ['babel']); + // Tests + grunt.registerTask('test', ['qunit:all']); + + // Custom task running QUnit tests for specified files. + // Usage: grunt test-only:test.html,test-help.html + grunt.registerTask('test-only', + 'A task that runs only specified tests.', + function(tests) { + if(!tests) { + return; + } + tests = tests.split(','); + var res = []; + + tests.forEach(function(itm) { + var filePath = path.resolve(testDir, itm); + var parts = filePath.split(path.sep); + res.push(buildTestUrl(testHost, testDir, parts)); + }); + + grunt.config('qunit.only.options.urls', res); + grunt.task.run('qunit:only'); + }); + + function isTestFile(pth) { + var allowedExts = ['.html', '.htm']; + for(var i=0, len=allowedExts.length; i0,this.onLoaded=l.Types.isFn(n.on_loaded)?n.on_loaded:null,this.onBeforeOpen=l.Types.isFn(n.on_before_open)?n.on_before_open:null,this.onAfterOpen=l.Types.isFn(n.on_after_open)?n.on_after_open:null,this.onBeforeClose=l.Types.isFn(n.on_before_close)?n.on_before_close:null,this.onAfterClose=l.Types.isFn(n.on_after_close)?n.on_after_close:null,this.onBeforeColHidden=l.Types.isFn(n.on_before_col_hidden)?n.on_before_col_hidden:null,this.onAfterColHidden=l.Types.isFn(n.on_after_col_hidden)?n.on_after_col_hidden:null,this.onBeforeColDisplayed=l.Types.isFn(n.on_before_col_displayed)?n.on_before_col_displayed:null,this.onAfterColDisplayed=l.Types.isFn(n.on_after_col_displayed)?n.on_after_col_displayed:null,e.gridLayout&&(this.headersTbl=e.Cpt.gridLayout.headTbl,this.headersIndex=0,this.onAfterColDisplayed=function(){},this.onAfterColHidden=function(){}),e.includeFile(n.name+"Style",e.basePath+this.stylesheet,null,"link"),this.tf=e}return n(t,[{key:"toggle",value:function(t){var e=(this.tf,this.contEl.style.display),s=this.onBeforeOpen,i=this.onBeforeClose,n=this.onAfterOpen,r=this.onAfterClose;s&&"inline"!==e&&s.call(null,this),i&&"inline"===e&&i.call(null,this),this.contEl.style.display="inline"===e?"none":"inline",n&&"inline"!==e&&n.call(null,this),r&&"inline"===e&&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?r.Dom.addClass(e,this.listSlcItemCssClass):r.Dom.removeClass(e,this.listSlcItemCssClass);var n=!1;(this.tickToHide&&s||!this.tickToHide&&!s)&&(n=!0),this.setHidden(i,n)}}},{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=r.Dom.create("span",["id",this.prfx+e.id]);s.className=this.spanCssClass,this.btnTgtId||e.setToolbar();var i=this.btnTgtId?r.Dom.id(this.btnTgtId):e.rDiv;if(this.btnTgtId)i.appendChild(s);else{var n=i.firstChild;n.parentNode.insertBefore(s,n)}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=r.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?r.Dom.id(this.contElTgtId):r.Dom.create("div",["id",this.prfxCont+e.id]);s.className=this.contCssClass;var i=r.Dom.create("p");i.innerHTML=this.text,s.appendChild(i);var n=r.Dom.create("ul",["id","ul"+this.extName+"_"+e.id]);n.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=r.Dom.createCheckItem("col__"+e.id,this.tickAllText,this.tickAllText);r.Dom.addClass(d,this.listItemCssClass),n.appendChild(d),d.check.checked=!this.tickToHide,a.Event.add(d.check,"click",function(t){for(var s=0;si.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 n=i.tHead.rows[i.headersRow].cells;i.tHead.ownerDocument||i.tHead.document}i.sortTypes=s||[];for(var r,l,a=n.length,o=0;a>o;o++)l=n[o],null!==i.sortTypes[o]&&"None"!==i.sortTypes[o]?(l.style.cursor="pointer",r=g.Dom.create("img",["src",t.sortImgPath+t.sortImgBlank]),l.appendChild(r),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,n,r=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&&(n=s[o].lastChild||s[o],"img"!==n.nodeName.toLowerCase()&&(n=g.Dom.create("img",["src",t.sortImgPath+t.sortImgBlank]),s[o].appendChild(n)),o===r.sortColumn?n.className=t.sortImgClassName+" "+(this.descending?t.sortImgDescClassName:t.sortImgAscClassName):n.className=t.sortImgClassName)}},SortableTable.prototype.getRowValue=function(t,e,s){var i=this,n=i._sortTypeInfo[e];if(n&&n.getRowValue)return n.getRowValue(t,s);var r=t.cells[s],l=SortableTable.getInnerText(r);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,r=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],{1:function(t,e,s){function i(t){return s(n(t))}function n(t){return r[t]||function(){throw new Error("Cannot find module '"+t+"'.")}()}var r={"./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/colsVisibility/colsVisibility":25,"./extensions/colsVisibility/colsVisibility.js":25,"./extensions/sort/adapterSortabletable":26,"./extensions/sort/adapterSortabletable.js":26,"./extensions/sort/sort":27,"./extensions/sort/sort.js":27,"./helpers":23,"./helpers.js":23,"./modules/alternateRows":21,"./modules/alternateRows.js":21,"./modules/checkList":15,"./modules/checkList.js":15,"./modules/clearButton":19,"./modules/clearButton.js":19,"./modules/colOps":22,"./modules/colOps.js":22,"./modules/dropdown":14,"./modules/dropdown.js":14,"./modules/gridLayout":10,"./modules/gridLayout.js":10,"./modules/help":20,"./modules/help.js":20,"./modules/highlightKeywords":12,"./modules/highlightKeywords.js":12,"./modules/loader":11,"./modules/loader.js":11,"./modules/paging":18,"./modules/paging.js":18,"./modules/popupFilter":13,"./modules/popupFilter.js":13,"./modules/rowsCounter":16,"./modules/rowsCounter.js":16,"./modules/statusBar":17,"./modules/statusBar.js":17,"./modules/store":9,"./modules/store.js":9,"./sort":24,"./sort.js":24,"./string":4,"./string.js":4,"./types":6,"./types.js":6};i.keys=function(){return Object.keys(r)},i.resolve=n,t.exports=i,i.id=1},25: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")},n=function(){function t(t,e){for(var s=0;s0,this.onLoaded=l.Types.isFn(n.on_loaded)?n.on_loaded:null,this.onBeforeOpen=l.Types.isFn(n.on_before_open)?n.on_before_open:null,this.onAfterOpen=l.Types.isFn(n.on_after_open)?n.on_after_open:null,this.onBeforeClose=l.Types.isFn(n.on_before_close)?n.on_before_close:null,this.onAfterClose=l.Types.isFn(n.on_after_close)?n.on_after_close:null,this.onBeforeColHidden=l.Types.isFn(n.on_before_col_hidden)?n.on_before_col_hidden:null,this.onAfterColHidden=l.Types.isFn(n.on_after_col_hidden)?n.on_after_col_hidden:null,this.onBeforeColDisplayed=l.Types.isFn(n.on_before_col_displayed)?n.on_before_col_displayed:null,this.onAfterColDisplayed=l.Types.isFn(n.on_after_col_displayed)?n.on_after_col_displayed:null,e.gridLayout&&(this.headersTbl=e.Cpt.gridLayout.headTbl,this.headersIndex=0,this.onAfterColDisplayed=function(){},this.onAfterColHidden=function(){}),e.includeFile(n.name+"Style",e.basePath+this.stylesheet,null,"link"),this.tf=e}return n(t,[{key:"toggle",value:function(){var t=this.contEl.style.display,e=this.onBeforeOpen,s=this.onBeforeClose,i=this.onAfterOpen,n=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),n&&"inline"===t&&n.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?r.Dom.addClass(e,this.listSlcItemCssClass):r.Dom.removeClass(e,this.listSlcItemCssClass);var n=!1;(this.tickToHide&&s||!this.tickToHide&&!s)&&(n=!0),this.setHidden(i,n)}}},{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=r.Dom.create("span",["id",this.prfx+e.id]);s.className=this.spanCssClass,this.btnTgtId||e.setToolbar();var i=this.btnTgtId?r.Dom.id(this.btnTgtId):e.rDiv;if(this.btnTgtId)i.appendChild(s);else{var n=i.firstChild;n.parentNode.insertBefore(s,n)}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=r.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?r.Dom.id(this.contElTgtId):r.Dom.create("div",["id",this.prfxCont+e.id]);s.className=this.contCssClass;var i=r.Dom.create("p");i.innerHTML=this.text,s.appendChild(i);var n=r.Dom.create("ul",["id","ul"+this.extName+"_"+e.id]);n.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=r.Dom.createCheckItem("col__"+e.id,this.tickAllText,this.tickAllText);r.Dom.addClass(d,this.listItemCssClass),n.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 n=i.tHead.rows[i.headersRow].cells;i.sortTypes=s||[];for(var r,l,a=n.length,o=0;a>o;o++)l=n[o],null!==i.sortTypes[o]&&"None"!==i.sortTypes[o]?(l.style.cursor="pointer",r=g.Dom.create("img",["src",t.sortImgPath+t.sortImgBlank]),l.appendChild(r),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,n,r=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&&(n=s[o].lastChild||s[o],"img"!==n.nodeName.toLowerCase()&&(n=g.Dom.create("img",["src",t.sortImgPath+t.sortImgBlank]),s[o].appendChild(n)),o===r.sortColumn?n.className=t.sortImgClassName+" "+(this.descending?t.sortImgDescClassName:t.sortImgAscClassName):n.className=t.sortImgClassName)}},SortableTable.prototype.getRowValue=function(t,e,s){var i=this,n=i._sortTypeInfo[e];if(n&&n.getRowValue)return n.getRowValue(t,s);var r=t.cells[s],l=SortableTable.getInnerText(r);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,r=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 diff --git a/dist/tablefilter/tablefilter.js b/dist/tablefilter/tablefilter.js index 64e68d6e..1746152c 100644 --- a/dist/tablefilter/tablefilter.js +++ b/dist/tablefilter/tablefilter.js @@ -1,7 +1,5 @@ -!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,a){for(var r,n,o=0,h=[];o1)for(var s=0;s1?this.filtersRowIndex=this.headersRow+1:(this.filtersRowIndex=1,this.headersRow=0)),this.fltCellTag="th"!==n.filters_cell_tag||"td"!==n.filters_cell_tag?"td":n.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=n.inf_div_css_class||"inf",this.lDivCssClass=n.left_div_css_class||"ldiv",this.rDivCssClass=n.right_div_css_class||"rdiv",this.mDivCssClass=n.middle_div_css_class||"mdiv",this.contDivCssClass=n.content_div_css_class||"cont",this.stylesheet=n.stylesheet||this.basePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=n.flts_row_css_class||"fltrow",this.enableIcons=n.enable_icons===!1?!1:!0,this.alternateBgs=n.alternate_rows===!0?!0:!1,this.hasColWidth=n.col_width===!0?!0:!1,this.colWidth=this.hasColWidth?n.col_width:null,this.fixedHeaders=n.fixed_headers===!0?!0:!1,this.tBodyH=isNaN(n.tbody_height)?200:n.tbody_height,this.fltCssClass=n.flt_css_class||"flt",this.fltMultiCssClass=n.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=n.flt_small_css_class||"flt_s",this.singleFltCssClass=n.single_flt_css_class||"single_flt",this.isStartBgAlternate=!0,this.enterKey=n.enter_key===!1?!1:!0,this.isModFilterFn=n.mod_filter_fn===!0?!0:!1,this.modFilterFn=this.isModFilterFn?n.mod_filter_fn:null,this.onBeforeFilter=c.Types.isFn(n.on_before_filter)?n.on_before_filter:null,this.onAfterFilter=c.Types.isFn(n.on_after_filter)?n.on_after_filter:null,this.matchCase=n.match_case===!0?!0:!1,this.exactMatch=n.exact_match===!0?!0:!1,this.linkedFilters=n.linked_filters===!0?!0:!1,this.disableExcludedOptions=n.disable_excluded_options===!0?!0:!1,this.activeFlt=null,this.activeFilterId=null,this.hasColOperation=n.col_operation?!0:!1,this.colOperation=null,this.hasVisibleRows=n.rows_always_visible?!0:!1,this.visibleRows=this.hasVisibleRows?n.rows_always_visible:[],this.searchType=n.search_type||"include",this.isExternalFlt=n.external_flt_grid===!0?!0:!1,this.externalFltTgtIds=n.external_flt_grid_ids||null,this.externalFltEls=[],this.execDelay=isNaN(n.exec_delay)?100:parseInt(n.exec_delay,10),this.onFiltersLoaded=c.Types.isFn(n.on_filters_loaded)?n.on_filters_loaded:null,this.singleSearchFlt=n.single_search_filter===!0?!0:!1,this.onRowValidated=c.Types.isFn(n.on_row_validated)?n.on_row_validated:null,this.customCellDataCols=n.custom_cell_data_cols?n.custom_cell_data_cols:[],this.customCellData=c.Types.isFn(n.custom_cell_data)?n.custom_cell_data:null,this.watermark=n.watermark||"",this.isWatermarkArray=c.Types.isArray(this.watermark),this.toolBarTgtId=n.toolbar_target_id||null,this.helpInstructions=n.help_instructions||!1,this.popUpFilters=n.popup_filters===!0?!0:!1,this.markActiveColumns=n.mark_active_columns===!0?!0:!1,this.activeColumnsCssClass=n.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=c.Types.isFn(n.on_before_active_column)?n.on_before_active_column:null,this.onAfterActiveColumn=c.Types.isFn(n.on_after_active_column)?n.on_after_active_column:null,this.displayAllText=n.display_all_text||"",this.enableEmptyOption=n.enable_empty_option===!0?!0:!1,this.emptyText=n.empty_text||"(Empty)",this.enableNonEmptyOption=n.enable_non_empty_option===!0?!0:!1,this.nonEmptyText=n.non_empty_text||"(Non empty)",this.onSlcChange=n.on_change===!1?!1:!0,this.sortSlc=n.sort_select===!1?!1:!0,this.isSortNumAsc=n.sort_num_asc===!0?!0:!1,this.sortNumAsc=this.isSortNumAsc?n.sort_num_asc:null,this.isSortNumDesc=n.sort_num_desc===!0?!0:!1,this.sortNumDesc=this.isSortNumDesc?n.sort_num_desc:null,this.fillSlcOnDemand=n.fill_slc_on_demand===!0?!0:!1,this.hasCustomSlcOptions=c.Types.isObj(n.custom_slc_options)?!0:!1,this.customSlcOptions=c.Types.isArray(n.custom_slc_options)?n.custom_slc_options:null,this.rgxOperator=n.regexp_operator||"rgx:",this.emOperator=n.empty_operator||"[empty]",this.nmOperator=n.nonempty_operator||"[nonempty]",this.orOperator=n.or_operator||"||",this.anOperator=n.and_operator||"&&",this.grOperator=n.greater_operator||">",this.lwOperator=n.lower_operator||"<",this.leOperator=n.lower_equal_operator||"<=",this.geOperator=n.greater_equal_operator||">=",this.dfOperator=n.different_operator||"!",this.lkOperator=n.like_operator||"*",this.eqOperator=n.equal_operator||"=",this.stOperator=n.start_with_operator||"{",this.enOperator=n.end_with_operator||"}",this.curExp=n.cur_exp||"^[¥£€$]",this.separator=n.separator||",",this.rowsCounter=n.rows_counter===!0?!0:!1,this.statusBar=n.status_bar===!0?!0:!1,this.loader=n.loader===!0?!0:!1,this.displayBtn=n.btn===!0?!0:!1,this.btnText=n.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=n.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=n.btn_reset===!0?!0:!1,this.btnResetCssClass=n.btn_reset_css_class||"reset",this.onBeforeReset=c.Types.isFn(n.on_before_reset)?n.on_before_reset:null,this.onAfterReset=c.Types.isFn(n.on_after_reset)?n.on_after_reset:null,this.paging=n.paging===!0?!0:!1,this.nbVisibleRows=0,this.nbHiddenRows=0,this.sort=n.sort===!0?!0:!1,this.isSortEnabled=!1,this.sortConfig=n.sort_config||{},this.sortConfig.name=void 0!==this.sortConfig.name?n.sort_config.name:"sortabletable",this.sortConfig.src=void 0!==this.sortConfig.src?n.sort_config.src:this.extensionsPath+"sort/sortabletable.js",this.sortConfig.adapterSrc=void 0!==this.sortConfig.adapter_src?n.sort_config.adapter_src:this.extensionsPath+"sort/adapterSortabletable.js",this.sortConfig.initialize=void 0!==this.sortConfig.initialize?n.sort_config.initialize:function(t){},this.sortConfig.sortTypes=c.Types.isArray(this.sortConfig.sort_types)?n.sort_config.sort_types:[],this.sortConfig.sortCol=void 0!==this.sortConfig.sort_col?n.sort_config.sort_col:null,this.sortConfig.asyncSort=this.sortConfig.async_sort===!0?!0:!1,this.sortConfig.triggerIds=c.Types.isArray(this.sortConfig.sort_trigger_ids)?n.sort_config.sort_trigger_ids:[],this.selectable=n.selectable===!0?!0:!1,this.editable=n.editable===!0?!0:!1,this.ezEditTableConfig=n.ezEditTable_config||{},this.ezEditTableConfig.name=void 0!==this.ezEditTableConfig.name?n.ezEditTable_config.name:"ezedittable",this.ezEditTableConfig.src=void 0!==this.ezEditTableConfig.src?n.ezEditTable_config.src:this.extensionsPath+"ezEditTable/ezEditTable.js",this.ezEditTableConfig.loadStylesheet=this.ezEditTableConfig.loadStylesheet===!0?!0:!1,this.ezEditTableConfig.stylesheet=this.ezEditTableConfig.stylesheet||this.extensionsPath+"ezEditTable/ezEditTable.css",this.ezEditTableConfig.stylesheetName=void 0!==this.ezEditTableConfig.stylesheetName?n.ezEditTable_config.stylesheetName:"ezEditTableCss",this.ezEditTableConfig.err='Failed to instantiate EditTable object.\n"ezEditTable" module may not be available.',this.onKeyUp=n.on_keyup===!0?!0:!1,this.onKeyUpDelay=isNaN(n.on_keyup_delay)?900:n.on_keyup_delay,this.isUserTyping=null,this.onKeyUpTimer=void 0,this.highlightKeywords=n.highlight_keywords===!0?!0:!1,this.defaultDateType=n.default_date_type||"DMY",this.thousandsSeparator=n.thousands_separator||",",this.decimalSeparator=n.decimal_separator||".",this.hasColNbFormat=n.col_number_format===!0?!0:!1,this.colNbFormat=c.Types.isArray(this.hasColNbFormat)?n.col_number_format:null,this.hasColDateType=n.col_date_type===!0?!0:!1,this.colDateType=c.Types.isArray(this.hasColDateType)?n.col_date_type:null,this.msgFilter=n.msg_filter||"Filtering data...",this.msgPopulate=n.msg_populate||"Populating filter...",this.msgPopulateCheckList=n.msg_populate_checklist||"Populating list...",this.msgChangePage=n.msg_change_page||"Collecting paging data...",this.msgClear=n.msg_clear||"Clearing filters...",this.msgChangeResults=n.msg_change_results||"Changing results per page...",this.msgResetValues=n.msg_reset_grid_values||"Re-setting filters values...",this.msgResetPage=n.msg_reset_page||"Re-setting page...",this.msgResetPageLength=n.msg_reset_page_length||"Re-setting page length...",this.msgSort=n.msg_sort||"Sorting data...",this.msgLoadExtensions=n.msg_load_extensions||"Loading extensions...",this.msgLoadThemes=n.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=n.remember_grid_values===!0?!0:!1,this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&n.remember_page_number?!0:!1,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&n.remember_page_length?!0:!1,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=n.extensions,this.hasExtensions=c.Types.isArray(this.extensions),this.enableDefaultTheme=n.enable_default_theme===!0?!0:!1,this.hasThemes=n.enable_default_theme||n.themes&&c.Types.isObj(n.themes)?!0:!1,this.themes=this.hasThemes?n.themes:null,this.themesPath=n.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(t){g.onKeyUp&&(g.isUserTyping=!0)},onInpBlur:function(t){g.onKeyUp&&(g.isUserTyping=!1,D.clearInterval(g.onKeyUpTimer)),g.ezEditTable&&(g.editable&&g.ezEditTable.Editable.Set(),g.selectable&&g.ezEditTable.Selection.Set())},onInpFocus:function(t){var e=t||D.event;g.activeFilterId=this.getAttribute("id"),g.activeFlt=h.Dom.id(g.activeFilterId),g.popUpFilters&&(e.Event.cancel(e),e.Event.stop(e)),g.ezEditTable&&(g.editable&&g.ezEditTable.Editable.Remove(),g.selectable&&g.ezEditTable.Selection.Remove())},onSlcFocus:function(t){var e=t||D.event;if(g.activeFilterId=this.getAttribute("id"),g.activeFlt=h.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=(g.activeFlt.getAttribute("colIndex"),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(t){g.activeFilterId=this.firstChild.getAttribute("id"),g.activeFlt=h.Dom.id(g.activeFilterId)},onBtnClick:function(){g.filter()}}}}return n(t,[{key:"init",value:function(){if(!this._hasGrid){this.tbl||(this.tbl=h.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.includeFile(this.stylesheetId,this.stylesheet,null,"link"),this.hasThemes&&this._loadThemes(),(this.rememberGridValues||this.rememberPageNb||this.rememberPageLen)&&(this.Cpt.store=new g.Store(this)),this.gridLayout&&(this.Cpt.gridLayout=new v.GridLayout(this),this.Cpt.gridLayout.init()),this.loader&&(this.Cpt.loader||(this.Cpt.loader=new m.Loader(this))),this.highlightKeywords&&(this.Cpt.highlightKeyword=new b.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=h.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 a=0;s>a;a++){this.popUpFilters&&this.Cpt.popupFilter.build(a);var r=h.Dom.create(this.fltCellTag),n=this["col"+a],d=this.isExternalFlt&&this.externalFltTgtIds?this.externalFltTgtIds[a]:null;if(this.singleSearchFlt&&(r.colSpan=this.nbCells),this.gridLayout||i.appendChild(r),t=a==s-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,void 0===n&&(n=void 0===e["col_"+a]?this.fltTypeInp:p.Str.lower(e["col_"+a])),this.singleSearchFlt&&(n=this.fltTypeInp,t=this.singleFltCssClass),n===this.fltTypeSlc||n===this.fltTypeMulti){this.Cpt.dropdown||(this.Cpt.dropdown=new _.Dropdown(this));var c=this.Cpt.dropdown,u=h.Dom.create(this.fltTypeSlc,["id",this.prfxFlt+a+"_"+this.id],["ct",a],["filled","0"]);if(n===this.fltTypeMulti&&(u.multiple=this.fltTypeMulti,u.title=c.multipleSlcTooltip),u.className=p.Str.lower(n)===this.fltTypeSlc?t:this.fltMultiCssClass,d?(h.Dom.id(d).appendChild(u),this.externalFltEls.push(u)):r.appendChild(u),this.fltIds.push(this.prfxFlt+a+"_"+this.id),this.fillSlcOnDemand||c._build(a),o.Event.add(u,"keypress",this.Evt.detectKey),o.Event.add(u,"change",this.Evt.onSlcChange),o.Event.add(u,"focus",this.Evt.onSlcFocus),this.fillSlcOnDemand){var f=h.Dom.createOpt(this.displayAllText,"");u.appendChild(f)}}else if(n===this.fltTypeCheckList){var D;this.Cpt.checkList||(this.Cpt.checkList=new y.CheckList(this),D=this.Cpt.checkList);var F=h.Dom.create("div",["id",D.prfxCheckListDiv+a+"_"+this.id],["ct",a],["filled","0"]);F.className=D.checkListDivCssClass,d?(h.Dom.id(d).appendChild(F),this.externalFltEls.push(F)):r.appendChild(F),D.checkListDiv[a]=F,this.fltIds.push(this.prfxFlt+a+"_"+this.id),this.fillSlcOnDemand||D._build(a),this.fillSlcOnDemand&&(o.Event.add(F,"click",this.Evt.onCheckListClick),F.appendChild(h.Dom.text(D.activateCheckListTxt))),o.Event.add(F,"click",this.Evt.onCheckListFocus)}else{var E=n===this.fltTypeInp?"text":"hidden",P=h.Dom.create(this.fltTypeInp,["id",this.prfxFlt+a+"_"+this.id],["type",E],["ct",a]);if("hidden"!==E&&this.watermark&&P.setAttribute("placeholder",this.isWatermarkArray?this.watermark[a]||"":this.watermark),P.className=t,P.onfocus=this.Evt.onInpFocus,d?(h.Dom.id(d).appendChild(P),this.externalFltEls.push(P)):r.appendChild(P),this.fltIds.push(this.prfxFlt+a+"_"+this.id),P.onkeypress=this.Evt.detectKey,P.onkeydown=this.Evt.onKeyDown,P.onkeyup=this.Evt.onKeyUp,P.onblur=this.Evt.onInpBlur,this.rememberGridValues){var L=this.Cpt.store.getFilterValues(this.fltsValuesCookie);" "!=L[a]&&this.setFilterValue(a,L[a],!1)}}if(a==s-1&&this.displayBtn){var N=h.Dom.create(this.fltTypeInp,["id",this.prfxValButton+a+"_"+this.id],["type","button"],["value",this.btnText]);N.className=this.btnCssClass,d?h.Dom.id(d).appendChild(N):r.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 w.RowsCounter(this),this.Cpt.rowsCounter.init()),this.statusBar&&(this.Cpt.statusBar=new x.StatusBar(this),this.Cpt.statusBar.init()),(this.paging||this.Cpt.paging&&this.Cpt.paging.isPagingRemoved)&&(this.Cpt.paging=new T.Paging(this),this.Cpt.paging.init()),this.btnReset&&(this.Cpt.clearButton=new k.ClearButton(this),this.Cpt.clearButton.init()),this.helpInstructions&&(this.Cpt.help=new I.Help(this),this.Cpt.help.init()),this.hasColWidth&&!this.gridLayout&&this.setColWidths(),this.alternateBgs&&(this.Cpt.alternateRows=new R.AlternateRows(this),this.Cpt.alternateRows.init()),this.hasColOperation&&(this.Cpt.colOps=new S.ColOps(this),this.Cpt.colOps.calc()),this.sort&&this.setSort(),(this.selectable||this.editable)&&this.setEditable(),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||h.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,e){function s(){if(t){switch(t){case i.Evt.name.filter:i.isModFilterFn?i.modFilterFn.call(null,i):i._filter();break;case i.Evt.name.dropdown:i.linkedFilters?i.Cpt.dropdown._build(l,!0):i.Cpt.dropdown._build(l,!1,a,r);break;case i.Evt.name.checklist:i.Cpt.checkList._build(l,a,r);break;case i.Evt.name.changepage:i.Cpt.paging._changePage(n);break;case i.Evt.name.clear:i._clearFilters(),i._filter();break;case i.Evt.name.changeresultsperpage:i.Cpt.paging._changeResultsPerPage();break;case i.Evt.name.resetvalues:i._resetValues(),i._filter();break;case i.Evt.name.resetpage:i.Cpt.paging._resetPage(i.pgNbCookie);break;case i.Evt.name.resetpagelength:i.Cpt.paging._resetPageLength(i.pgLenCookie);break;case i.Evt.name.sort:break;case i.Evt.name.loadextensions:i._loadExtensions();break;case i.Evt.name.loadthemes:i._loadThemes();break;default:i["_"+t].call(null,i,e)}i.statusBar&&i.Cpt.statusBar.message(""),i.loader&&i.Cpt.loader.show("none")}}var i=this,l=e&&void 0!==e.slcIndex?e.slcIndex:null,a=e&&void 0!==e.slcExternal?e.slcExternal:!1,r=e&&void 0!==e.slcId?e.slcId:null,n=e&&void 0!==e.pgIndex?e.pgIndex:null;if(this.loader||this.statusBar){try{this.Cpt.loader.show(""),this.Cpt.statusBar.message(this["msg"+t])}catch(o){}D.setTimeout(s,this.execDelay)}else s()}},{key:"initExtensions",value:function(){for(var t=this.extensions,e=0;e',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null}}},{key:"remove",value:function(){if(this.fltGrid&&this._hasGrid){var t=this.tbl.rows;this.paging&&this.Cpt.paging.destroy(),this.statusBar&&this.Cpt.statusBar.destroy(),this.rowsCounter&&this.Cpt.rowsCounter.destroy(),this.btnReset&&this.Cpt.clearButton.destroy(),this.helpInstructions&&this.Cpt.help.destroy(),this.isExternalFlt&&!this.popUpFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&this.Cpt.highlightKeyword.unhighlightAll(),this.sort&&this.ExtRegistry.sort.destroy(),this.loader&&this.Cpt.loader.remove(),this.popUpFilters&&this.Cpt.popupFilter.destroy(),this.markActiveColumns&&this.clearActiveColumns(),(this.editable||this.selectable)&&this.removeEditable();for(var e=this.refRow;e0&&!s.startRow?void 0:s.startRow||t.refRow,s.scroll_into_view=s.scroll_into_view===!1?!1:!0,s.base_path=s.base_path||t.basePath+"ezEditTable/",s.editable=t.editable=t.cfg.editable,s.selection=t.selectable=t.cfg.selectable,t.selectable&&(s.default_selection=s.default_selection||"row"),s.active_cell_css=s.active_cell_css||"ezETSelectedCell",t._lastValidRowIndex=0,t._lastRowIndex=0,t.selectable){var l=function(e,s,i){var l=e.Selection,a=function(i){if("row"===e.defaultSelection)l.SelectRowByIndex(i);else{e.ClearSelections();var a=s.cellIndex,r=t.tbl.rows[i];"both"===e.defaultSelection&&l.SelectRowByIndex(i),r&&l.SelectCell(r.cells[a])}if(t.validRowsIndex.length!==t.getRowsNb()){var n=t.tbl.rows[i];n&&n.scrollIntoView(!1),p&&(p.cellIndex===t.getCellsNb()-1&&t.gridLayout?t.tblCont.scrollLeft=1e8:0===p.cellIndex&&t.gridLayout?t.tblCont.scrollLeft=0:p.scrollIntoView(!1))}};if(t.validRowsIndex){var r,n=t.validRowsIndex,o=n.length,h="row"!==e.defaultSelection?s.parentNode:s,p="TD"===s.nodeName?s:null,d=void 0!==i?e.Event.GetKey(i):0,c=u.Arr.has(n,h.rowIndex),f=34===d||33===d?t.pagingLength||e.nbRowsPerPage:1;if(c)34!==d&&33!==d?(t._lastValidRowIndex=u.Arr.indexByValue(n,h.rowIndex),t._lastRowIndex=h.rowIndex):(r=34===d?t._lastValidRowIndex+f<=o-1?n[t._lastValidRowIndex+f]:[o-1]:t._lastValidRowIndex-f<=n[0]?n[0]:n[t._lastValidRowIndex-f],t._lastRowIndex=r,t._lastValidRowIndex=u.Arr.indexByValue(n,r),a(r));else{if(h.rowIndex>t._lastRowIndex)if(h.rowIndex>=n[o-1])r=n[o-1];else{var g=t._lastValidRowIndex+f;r=g>o-1?n[o-1]:n[g]}else if(h.rowIndex<=n[0])r=n[0];else{var v=n[t._lastValidRowIndex-f];r=v?v:n[0]}t._lastRowIndex=h.rowIndex,a(r)}}},a=function(e,s,i){var l="row"!==e.defaultSelection?s.parentNode:s;if(t.paging&&t.Cpt.paging.nbPages>1){var a=t.Cpt.paging;e.nbRowsPerPage=a.pagingLength;var r=t.validRowsIndex,n=r.length,o=parseInt(a.startPagingRow,10)+parseInt(a.pagingLength,10),h=l.rowIndex;h===r[n-1]&&a.currentPageNb!==a.nbPages?a.setPage("last"):h==r[0]&&1!==a.currentPageNb?a.setPage("first"):h>r[o-1]&&hr[0]&&a.setPage("previous")}};if(t.paging&&(t.onAfterChangePage=function(t,e){var s=t.ExtRegistry.ezEditTable,i=s.Selection,l=i.GetActiveRow();l&&l.scrollIntoView(!1);var a=i.GetActiveCell();a&&a.scrollIntoView(!1)}),"row"===s.default_selection){var r=s.on_before_selected_row;s.on_before_selected_row=function(){a(arguments[0],arguments[1],arguments[2]),r&&r.call(null,arguments[0],arguments[1],arguments[2])};var n=s.on_after_selected_row;s.on_after_selected_row=function(){l(arguments[0],arguments[1],arguments[2]),n&&n.call(null,arguments[0],arguments[1],arguments[2])}}else{var o=s.on_before_selected_cell;s.on_before_selected_cell=function(){a(arguments[0],arguments[1],arguments[2]),o&&o.call(null,arguments[0],arguments[1],arguments[2])};var p=s.on_after_selected_cell;s.on_after_selected_cell=function(){l(arguments[0],arguments[1],arguments[2]),p&&p.call(null,arguments[0],arguments[1],arguments[2])}}}if(t.editable){var d=s.on_added_dom_row;if(s.on_added_dom_row=function(){t.nbFilterableRows++,t.paging?(t.nbRows++,t.nbVisibleRows++,t.nbFilterableRows++,t.paging=!1,t.Cpt.paging.destroy(),t.Cpt.paging.addPaging()):t.Cpt.rowsCounter.refresh(),t.alternateBgs&&t.Cpt.alternateRows.init(),d&&d.call(null,arguments[0],arguments[1],arguments[2])},s.actions&&s.actions["delete"]){var c=s.actions["delete"].on_after_submit;s.actions["delete"].on_after_submit=function(){t.nbFilterableRows--,t.paging?(t.nbRows--,t.nbVisibleRows--,t.nbFilterableRows--,t.paging=!1,t.Cpt.paging.destroy(),t.Cpt.paging.addPaging(!1)):t.Cpt.rowsCounter.refresh(),t.alternateBgs&&t.Cpt.alternateRows.init(),c&&c.call(null,arguments[0],arguments[1])}}}try{t.ExtRegistry.ezEditTable=new EditTable(t.id,s,e),t.ExtRegistry.ezEditTable.Init()}catch(f){console.log(s.err)}}},{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.resetPageLength(this.pgLenCookie),this.rememberPageNb&&this.Cpt.paging.resetPage(this.pgNbCookie); +!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,a){for(var r,n,o=0,h=[];o1)for(var s=0;s1?this.filtersRowIndex=this.headersRow+1:(this.filtersRowIndex=1,this.headersRow=0)),this.fltCellTag="th"!==n.filters_cell_tag||"td"!==n.filters_cell_tag?"td":n.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=n.inf_div_css_class||"inf",this.lDivCssClass=n.left_div_css_class||"ldiv",this.rDivCssClass=n.right_div_css_class||"rdiv",this.mDivCssClass=n.middle_div_css_class||"mdiv",this.contDivCssClass=n.content_div_css_class||"cont",this.stylesheet=n.stylesheet||this.basePath+"tablefilter.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=n.flts_row_css_class||"fltrow",this.enableIcons=n.enable_icons===!1?!1:!0,this.alternateBgs=n.alternate_rows===!0?!0:!1,this.hasColWidth=n.col_width===!0?!0:!1,this.colWidth=this.hasColWidth?n.col_width:null,this.fixedHeaders=n.fixed_headers===!0?!0:!1,this.tBodyH=isNaN(n.tbody_height)?200:n.tbody_height,this.fltCssClass=n.flt_css_class||"flt",this.fltMultiCssClass=n.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=n.flt_small_css_class||"flt_s",this.singleFltCssClass=n.single_flt_css_class||"single_flt",this.isStartBgAlternate=!0,this.enterKey=n.enter_key===!1?!1:!0,this.isModFilterFn=n.mod_filter_fn===!0?!0:!1,this.modFilterFn=this.isModFilterFn?n.mod_filter_fn:null,this.onBeforeFilter=d.Types.isFn(n.on_before_filter)?n.on_before_filter:null,this.onAfterFilter=d.Types.isFn(n.on_after_filter)?n.on_after_filter:null,this.matchCase=n.match_case===!0?!0:!1,this.exactMatch=n.exact_match===!0?!0:!1,this.linkedFilters=n.linked_filters===!0?!0:!1,this.disableExcludedOptions=n.disable_excluded_options===!0?!0:!1,this.activeFlt=null,this.activeFilterId=null,this.hasColOperation=n.col_operation?!0:!1,this.colOperation=null,this.hasVisibleRows=n.rows_always_visible?!0:!1,this.visibleRows=this.hasVisibleRows?n.rows_always_visible:[],this.searchType=n.search_type||"include",this.isExternalFlt=n.external_flt_grid===!0?!0:!1,this.externalFltTgtIds=n.external_flt_grid_ids||null,this.externalFltEls=[],this.execDelay=isNaN(n.exec_delay)?100:parseInt(n.exec_delay,10),this.onFiltersLoaded=d.Types.isFn(n.on_filters_loaded)?n.on_filters_loaded:null,this.singleSearchFlt=n.single_search_filter===!0?!0:!1,this.onRowValidated=d.Types.isFn(n.on_row_validated)?n.on_row_validated:null,this.customCellDataCols=n.custom_cell_data_cols?n.custom_cell_data_cols:[],this.customCellData=d.Types.isFn(n.custom_cell_data)?n.custom_cell_data:null,this.watermark=n.watermark||"",this.isWatermarkArray=d.Types.isArray(this.watermark),this.toolBarTgtId=n.toolbar_target_id||null,this.helpInstructions=n.help_instructions||!1,this.popUpFilters=n.popup_filters===!0?!0:!1,this.markActiveColumns=n.mark_active_columns===!0?!0:!1,this.activeColumnsCssClass=n.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=d.Types.isFn(n.on_before_active_column)?n.on_before_active_column:null,this.onAfterActiveColumn=d.Types.isFn(n.on_after_active_column)?n.on_after_active_column:null,this.displayAllText=n.display_all_text||"",this.enableEmptyOption=n.enable_empty_option===!0?!0:!1,this.emptyText=n.empty_text||"(Empty)",this.enableNonEmptyOption=n.enable_non_empty_option===!0?!0:!1,this.nonEmptyText=n.non_empty_text||"(Non empty)",this.onSlcChange=n.on_change===!1?!1:!0,this.sortSlc=n.sort_select===!1?!1:!0,this.isSortNumAsc=n.sort_num_asc===!0?!0:!1,this.sortNumAsc=this.isSortNumAsc?n.sort_num_asc:null,this.isSortNumDesc=n.sort_num_desc===!0?!0:!1,this.sortNumDesc=this.isSortNumDesc?n.sort_num_desc:null,this.fillSlcOnDemand=n.fill_slc_on_demand===!0?!0:!1,this.hasCustomSlcOptions=d.Types.isObj(n.custom_slc_options)?!0:!1,this.customSlcOptions=d.Types.isArray(n.custom_slc_options)?n.custom_slc_options:null,this.rgxOperator=n.regexp_operator||"rgx:",this.emOperator=n.empty_operator||"[empty]",this.nmOperator=n.nonempty_operator||"[nonempty]",this.orOperator=n.or_operator||"||",this.anOperator=n.and_operator||"&&",this.grOperator=n.greater_operator||">",this.lwOperator=n.lower_operator||"<",this.leOperator=n.lower_equal_operator||"<=",this.geOperator=n.greater_equal_operator||">=",this.dfOperator=n.different_operator||"!",this.lkOperator=n.like_operator||"*",this.eqOperator=n.equal_operator||"=",this.stOperator=n.start_with_operator||"{",this.enOperator=n.end_with_operator||"}",this.curExp=n.cur_exp||"^[¥£€$]",this.separator=n.separator||",",this.rowsCounter=n.rows_counter===!0?!0:!1,this.statusBar=n.status_bar===!0?!0:!1,this.loader=n.loader===!0?!0:!1,this.displayBtn=n.btn===!0?!0:!1,this.btnText=n.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=n.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=n.btn_reset===!0?!0:!1,this.btnResetCssClass=n.btn_reset_css_class||"reset",this.onBeforeReset=d.Types.isFn(n.on_before_reset)?n.on_before_reset:null,this.onAfterReset=d.Types.isFn(n.on_after_reset)?n.on_after_reset:null,this.paging=n.paging===!0?!0:!1,this.nbVisibleRows=0,this.nbHiddenRows=0,this.sort=n.sort===!0?!0:!1,this.isSortEnabled=!1,this.sortConfig=n.sort_config||{},this.sortConfig.name=this.sortConfig.name||"sort",this.sortConfig.adapterSrc=this.sortConfig.adapter_src||this.extensionsPath+"sort/adapterSortabletable.js",this.sortConfig.sortTypes=d.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=d.Types.isArray(this.sortConfig.sort_trigger_ids)?this.sortConfig.sort_trigger_ids:[],this.selectable=n.selectable===!0?!0:!1,this.editable=n.editable===!0?!0:!1,this.ezEditTableConfig=n.ezEditTable_config||{},this.ezEditTableConfig.name=void 0!==this.ezEditTableConfig.name?n.ezEditTable_config.name:"ezedittable",this.ezEditTableConfig.src=void 0!==this.ezEditTableConfig.src?n.ezEditTable_config.src:this.extensionsPath+"ezEditTable/ezEditTable.js",this.ezEditTableConfig.loadStylesheet=this.ezEditTableConfig.loadStylesheet===!0?!0:!1,this.ezEditTableConfig.stylesheet=this.ezEditTableConfig.stylesheet||this.extensionsPath+"ezEditTable/ezEditTable.css",this.ezEditTableConfig.stylesheetName=void 0!==this.ezEditTableConfig.stylesheetName?n.ezEditTable_config.stylesheetName:"ezEditTableCss",this.ezEditTableConfig.err='Failed to instantiate EditTable object.\n"ezEditTable" module may not be available.',this.onKeyUp=n.on_keyup===!0?!0:!1,this.onKeyUpDelay=isNaN(n.on_keyup_delay)?900:n.on_keyup_delay,this.isUserTyping=null,this.onKeyUpTimer=void 0,this.highlightKeywords=n.highlight_keywords===!0?!0:!1,this.defaultDateType=n.default_date_type||"DMY",this.thousandsSeparator=n.thousands_separator||",",this.decimalSeparator=n.decimal_separator||".",this.hasColNbFormat=n.col_number_format===!0?!0:!1,this.colNbFormat=d.Types.isArray(this.hasColNbFormat)?n.col_number_format:null,this.hasColDateType=n.col_date_type===!0?!0:!1,this.colDateType=d.Types.isArray(this.hasColDateType)?n.col_date_type:null,this.msgFilter=n.msg_filter||"Filtering data...",this.msgPopulate=n.msg_populate||"Populating filter...",this.msgPopulateCheckList=n.msg_populate_checklist||"Populating list...",this.msgChangePage=n.msg_change_page||"Collecting paging data...",this.msgClear=n.msg_clear||"Clearing filters...",this.msgChangeResults=n.msg_change_results||"Changing results per page...",this.msgResetValues=n.msg_reset_grid_values||"Re-setting filters values...",this.msgResetPage=n.msg_reset_page||"Re-setting page...",this.msgResetPageLength=n.msg_reset_page_length||"Re-setting page length...",this.msgSort=n.msg_sort||"Sorting data...",this.msgLoadExtensions=n.msg_load_extensions||"Loading extensions...",this.msgLoadThemes=n.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=n.remember_grid_values===!0?!0:!1,this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&n.remember_page_number?!0:!1,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&n.remember_page_length?!0:!1,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.extensions=n.extensions,this.hasExtensions=d.Types.isArray(this.extensions),this.enableDefaultTheme=n.enable_default_theme===!0?!0:!1,this.hasThemes=n.enable_default_theme||n.themes&&d.Types.isObj(n.themes)?!0:!1,this.themes=this.hasThemes?n.themes:null,this.themesPath=n.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||S.event;if(e){var s=e.Event.keyCode(e);13===s?(g._filter(),e.Event.cancel(e),e.Event.stop(e)):(g.isUserTyping=!0,S.clearInterval(g.onKeyUpTimer),g.onKeyUpTimer=void 0)}}},onKeyUp:function(t){function e(){S.clearInterval(g.onKeyUpTimer),g.onKeyUpTimer=void 0,g.isUserTyping||(g.filter(),g.isUserTyping=null)}if(g.onKeyUp){var s=t||S.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=S.setInterval(e,g.onKeyUpDelay)):(S.clearInterval(g.onKeyUpTimer),g.onKeyUpTimer=void 0)}},onKeyDown:function(){g.onKeyUp&&(g.isUserTyping=!0)},onInpBlur:function(){g.onKeyUp&&(g.isUserTyping=!1,S.clearInterval(g.onKeyUpTimer)),g.ezEditTable&&(g.editable&&g.ezEditTable.Editable.Set(),g.selectable&&g.ezEditTable.Selection.Set())},onInpFocus:function(t){var e=t||S.event;g.activeFilterId=this.getAttribute("id"),g.activeFlt=o.Dom.id(g.activeFilterId),g.popUpFilters&&(e.Event.cancel(e),e.Event.stop(e)),g.ezEditTable&&(g.editable&&g.ezEditTable.Editable.Remove(),g.selectable&&g.ezEditTable.Selection.Remove())},onSlcFocus:function(t){var e=t||S.event;if(g.activeFilterId=this.getAttribute("id"),g.activeFlt=o.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||S.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=o.Dom.id(g.activeFilterId)},onBtnClick:function(){g.filter()}}}}return r(t,[{key:"init",value:function(){if(!this._hasGrid){this.tbl||(this.tbl=o.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.includeFile(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=o.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 a=0;s>a;a++){this.popUpFilters&&this.Cpt.popupFilter.build(a);var r=o.Dom.create(this.fltCellTag),p=this["col"+a],d=this.isExternalFlt&&this.externalFltTgtIds?this.externalFltTgtIds[a]:null;if(this.singleSearchFlt&&(r.colSpan=this.nbCells),this.gridLayout||i.appendChild(r),t=a==s-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,void 0===p&&(p=void 0===e["col_"+a]?this.fltTypeInp:h.Str.lower(e["col_"+a])),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 c=this.Cpt.dropdown,u=o.Dom.create(this.fltTypeSlc,["id",this.prfxFlt+a+"_"+this.id],["ct",a],["filled","0"]);if(p===this.fltTypeMulti&&(u.multiple=this.fltTypeMulti,u.title=c.multipleSlcTooltip),u.className=h.Str.lower(p)===this.fltTypeSlc?t:this.fltMultiCssClass,d?(o.Dom.id(d).appendChild(u),this.externalFltEls.push(u)):r.appendChild(u),this.fltIds.push(this.prfxFlt+a+"_"+this.id),this.fillSlcOnDemand||c._build(a),n.Event.add(u,"keypress",this.Evt.detectKey),n.Event.add(u,"change",this.Evt.onSlcChange),n.Event.add(u,"focus",this.Evt.onSlcFocus),this.fillSlcOnDemand){var S=o.Dom.createOpt(this.displayAllText,"");u.appendChild(S)}}else if(p===this.fltTypeCheckList){var D;this.Cpt.checkList||(this.Cpt.checkList=new _.CheckList(this),D=this.Cpt.checkList);var F=o.Dom.create("div",["id",D.prfxCheckListDiv+a+"_"+this.id],["ct",a],["filled","0"]);F.className=D.checkListDivCssClass,d?(o.Dom.id(d).appendChild(F),this.externalFltEls.push(F)):r.appendChild(F),D.checkListDiv[a]=F,this.fltIds.push(this.prfxFlt+a+"_"+this.id),this.fillSlcOnDemand||D._build(a),this.fillSlcOnDemand&&(n.Event.add(F,"click",this.Evt.onCheckListClick),F.appendChild(o.Dom.text(D.activateCheckListTxt))),n.Event.add(F,"click",this.Evt.onCheckListFocus)}else{var E=p===this.fltTypeInp?"text":"hidden",P=o.Dom.create(this.fltTypeInp,["id",this.prfxFlt+a+"_"+this.id],["type",E],["ct",a]);if("hidden"!==E&&this.watermark&&P.setAttribute("placeholder",this.isWatermarkArray?this.watermark[a]||"":this.watermark),P.className=t,P.onfocus=this.Evt.onInpFocus,d?(o.Dom.id(d).appendChild(P),this.externalFltEls.push(P)):r.appendChild(P),this.fltIds.push(this.prfxFlt+a+"_"+this.id),P.onkeypress=this.Evt.detectKey,P.onkeydown=this.Evt.onKeyDown,P.onkeyup=this.Evt.onKeyUp,P.onblur=this.Evt.onInpBlur,this.rememberGridValues){var L=this.Cpt.store.getFilterValues(this.fltsValuesCookie);" "!=L[a]&&this.setFilterValue(a,L[a],!1)}}if(a==s-1&&this.displayBtn){var N=o.Dom.create(this.fltTypeInp,["id",this.prfxValButton+a+"_"+this.id],["type","button"],["value",this.btnText]);N.className=this.btnCssClass,d?o.Dom.id(d).appendChild(N):r.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.setSort(),(this.selectable||this.editable)&&this.setEditable(),this.isFirstLoad=!1,this._hasGrid=!0,(this.rememberGridValues||this.rememberPageLen||this.rememberPageNb)&&this.resetValues(),this.gridLayout||o.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,e){function s(){if(t){switch(t){case i.Evt.name.filter:i.isModFilterFn?i.modFilterFn.call(null,i):i._filter();break;case i.Evt.name.dropdown:i.linkedFilters?i.Cpt.dropdown._build(l,!0):i.Cpt.dropdown._build(l,!1,a,r);break;case i.Evt.name.checklist:i.Cpt.checkList._build(l,a,r);break;case i.Evt.name.changepage:i.Cpt.paging._changePage(n);break;case i.Evt.name.clear:i._clearFilters(),i._filter();break;case i.Evt.name.changeresultsperpage:i.Cpt.paging._changeResultsPerPage();break;case i.Evt.name.resetvalues:i._resetValues(),i._filter();break;case i.Evt.name.resetpage:i.Cpt.paging._resetPage(i.pgNbCookie);break;case i.Evt.name.resetpagelength:i.Cpt.paging._resetPageLength(i.pgLenCookie);break;case i.Evt.name.sort:break;case i.Evt.name.loadextensions:i._loadExtensions();break;case i.Evt.name.loadthemes:i._loadThemes();break;default:i["_"+t].call(null,i,e)}i.statusBar&&i.Cpt.statusBar.message(""),i.loader&&i.Cpt.loader.show("none")}}var i=this,l=e&&void 0!==e.slcIndex?e.slcIndex:null,a=e&&void 0!==e.slcExternal?e.slcExternal:!1,r=e&&void 0!==e.slcId?e.slcId:null,n=e&&void 0!==e.pgIndex?e.pgIndex:null;if(this.loader||this.statusBar){try{this.Cpt.loader.show(""),this.Cpt.statusBar.message(this["msg"+t])}catch(o){}S.setTimeout(s,this.execDelay)}else s()}},{key:"initExtensions",value:function(){for(var t=this.extensions,e=0;e',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null}}},{key:"remove",value:function(){if(this.fltGrid&&this._hasGrid){var t=this.tbl.rows;this.paging&&this.Cpt.paging.destroy(),this.statusBar&&this.Cpt.statusBar.destroy(),this.rowsCounter&&this.Cpt.rowsCounter.destroy(),this.btnReset&&this.Cpt.clearButton.destroy(),this.helpInstructions&&this.Cpt.help.destroy(),this.isExternalFlt&&!this.popUpFilters&&this.removeExternalFlts(),this.infDiv&&this.removeToolbar(),this.highlightKeywords&&this.Cpt.highlightKeyword.unhighlightAll(),this.sort&&this.ExtRegistry.sort.destroy(),this.loader&&this.Cpt.loader.remove(),this.popUpFilters&&this.Cpt.popupFilter.destroy(),this.markActiveColumns&&this.clearActiveColumns(),(this.editable||this.selectable)&&this.removeEditable();for(var e=this.refRow;e0&&!s.startRow?void 0:s.startRow||t.refRow,s.scroll_into_view=s.scroll_into_view===!1?!1:!0,s.base_path=s.base_path||t.basePath+"ezEditTable/",s.editable=t.editable=t.cfg.editable,s.selection=t.selectable=t.cfg.selectable,t.selectable&&(s.default_selection=s.default_selection||"row"),s.active_cell_css=s.active_cell_css||"ezETSelectedCell",t._lastValidRowIndex=0,t._lastRowIndex=0,t.selectable){var l=function(e,s,i){var l=e.Selection,a=function(i){if("row"===e.defaultSelection)l.SelectRowByIndex(i);else{e.ClearSelections();var a=s.cellIndex,r=t.tbl.rows[i];"both"===e.defaultSelection&&l.SelectRowByIndex(i),r&&l.SelectCell(r.cells[a])}if(t.validRowsIndex.length!==t.getRowsNb()){var n=t.tbl.rows[i];n&&n.scrollIntoView(!1),p&&(p.cellIndex===t.getCellsNb()-1&&t.gridLayout?t.tblCont.scrollLeft=1e8:0===p.cellIndex&&t.gridLayout?t.tblCont.scrollLeft=0:p.scrollIntoView(!1))}};if(t.validRowsIndex){var r,n=t.validRowsIndex,o=n.length,h="row"!==e.defaultSelection?s.parentNode:s,p="TD"===s.nodeName?s:null,d=void 0!==i?e.Event.GetKey(i):0,u=c.Arr.has(n,h.rowIndex),f=34===d||33===d?t.pagingLength||e.nbRowsPerPage:1;if(u)34!==d&&33!==d?(t._lastValidRowIndex=c.Arr.indexByValue(n,h.rowIndex),t._lastRowIndex=h.rowIndex):(r=34===d?t._lastValidRowIndex+f<=o-1?n[t._lastValidRowIndex+f]:[o-1]:t._lastValidRowIndex-f<=n[0]?n[0]:n[t._lastValidRowIndex-f],t._lastRowIndex=r,t._lastValidRowIndex=c.Arr.indexByValue(n,r),a(r));else{if(h.rowIndex>t._lastRowIndex)if(h.rowIndex>=n[o-1])r=n[o-1];else{var g=t._lastValidRowIndex+f;r=g>o-1?n[o-1]:n[g]}else if(h.rowIndex<=n[0])r=n[0];else{var v=n[t._lastValidRowIndex-f];r=v?v:n[0]}t._lastRowIndex=h.rowIndex,a(r)}}},a=function(e,s){var i="row"!==e.defaultSelection?s.parentNode:s;if(t.paging&&t.Cpt.paging.nbPages>1){var l=t.Cpt.paging;e.nbRowsPerPage=l.pagingLength;var a=t.validRowsIndex,r=a.length,n=parseInt(l.startPagingRow,10)+parseInt(l.pagingLength,10),o=i.rowIndex;o===a[r-1]&&l.currentPageNb!==l.nbPages?l.setPage("last"):o==a[0]&&1!==l.currentPageNb?l.setPage("first"):o>a[n-1]&&oa[0]&&l.setPage("previous")}};if(t.paging&&(t.onAfterChangePage=function(t){var e=t.ExtRegistry.ezEditTable,s=e.Selection,i=s.GetActiveRow();i&&i.scrollIntoView(!1);var l=s.GetActiveCell();l&&l.scrollIntoView(!1)}),"row"===s.default_selection){var r=s.on_before_selected_row;s.on_before_selected_row=function(){a(arguments[0],arguments[1],arguments[2]),r&&r.call(null,arguments[0],arguments[1],arguments[2])};var n=s.on_after_selected_row;s.on_after_selected_row=function(){l(arguments[0],arguments[1],arguments[2]),n&&n.call(null,arguments[0],arguments[1],arguments[2])}}else{var h=s.on_before_selected_cell;s.on_before_selected_cell=function(){a(arguments[0],arguments[1],arguments[2]),h&&h.call(null,arguments[0],arguments[1],arguments[2])};var p=s.on_after_selected_cell;s.on_after_selected_cell=function(){l(arguments[0],arguments[1],arguments[2]),p&&p.call(null,arguments[0],arguments[1],arguments[2])}}}if(t.editable){var d=s.on_added_dom_row;if(s.on_added_dom_row=function(){t.nbFilterableRows++,t.paging?(t.nbRows++,t.nbVisibleRows++,t.nbFilterableRows++,t.paging=!1,t.Cpt.paging.destroy(),t.Cpt.paging.addPaging()):t.Cpt.rowsCounter.refresh(),t.alternateBgs&&t.Cpt.alternateRows.init(),d&&d.call(null,arguments[0],arguments[1],arguments[2])},s.actions&&s.actions["delete"]){var u=s.actions["delete"].on_after_submit;s.actions["delete"].on_after_submit=function(){t.nbFilterableRows--,t.paging?(t.nbRows--,t.nbVisibleRows--,t.nbFilterableRows--,t.paging=!1,t.Cpt.paging.destroy(),t.Cpt.paging.addPaging(!1)):t.Cpt.rowsCounter.refresh(),t.alternateBgs&&t.Cpt.alternateRows.init(),u&&u.call(null,arguments[0],arguments[1])}}}try{t.ExtRegistry.ezEditTable=new EditTable(t.id,s,e),t.ExtRegistry.ezEditTable.Init()}catch(f){console.log(s.err)}}},{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.resetPageLength(this.pgLenCookie),this.rememberPageNb&&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;lo):H?(c=F(t.replace(d,""),N),a=c>=o):j?(c=F(t.replace(u,""),N),a=o>=c):U?(c=F(t.replace(g,""),N),a=o>c):G?(c=F(t.replace(v,""),N),a=o.toString()!=c.toString()):z?(c=F(t.replace(C,""),N),a=o.toString()==c.toString()):m.test(t)?a=r._containsStr(t.replace(m,""),e,null,!1):D(t,N)?(c=F(t,N),a=o.toString()==c.toString()):B?a=h.Str.isEmpty(e):O&&(a=!h.Str.isEmpty(e));else if(r.hasColNbFormat&&r.colNbFormat[s]?(n=i(e,r.colNbFormat[s]),p=r.colNbFormat[s]):","===r.thousandsSeparator&&"."===r.decimalSeparator?(n=i(e,"us"),p="us"):(n=i(e,"eu"),p="eu"),k)a=n<=i(t.replace(d,""),p);else if(R)a=n>=i(t.replace(u,""),p);else if(T)a=ni(t.replace(g,""),p);else if(S)a=r._containsStr(t.replace(v,""),e)?!1:!0;else if(P)a=r._containsStr(t.replace(m,""),e,null,!1);else if(E)a=r._containsStr(t.replace(C,""),e,null,!0);else if(L)a=0===e.indexOf(t.replace(b,""))?!0:!1;else if(A){var K=t.replace(_,"");a=e.lastIndexOf(K,e.length-1)===e.length-1-(K.length-1)&&e.lastIndexOf(K,e.length-1)>-1?!0:!1}else if(B)a=h.Str.isEmpty(e);else if(O)a=!h.Str.isEmpty(e);else if(M)try{var W=t.replace(x,""),$=new RegExp(W);a=$.test(e)}catch(q){a=!1}else{var Y=l["col_"+s];a=r._containsStr(t,e,Y?Y:r.fltTypeInp)}return a}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this);var s=this.tbl.rows,l=this.cfg,a=0;this.validRowsIndex=[];var r=this;this.highlightKeywords&&this.Cpt.highlightKeyword.unhighlightAll(),this.popUpFilters&&this.Cpt.popupFilter.buildIcons(),this.markActiveColumns&&this.clearActiveColumns(),this.searchArgs=this.getFiltersValue();for(var n,p,d=new RegExp(this.leOperator),u=new RegExp(this.geOperator),f=new RegExp(this.lwOperator),g=new RegExp(this.grOperator),v=new RegExp(this.dfOperator),m=new RegExp(h.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(h.Str.rgxEsc(this.rgxOperator)),T=this.refRow;TP;P++){var L=this.searchArgs[this.singleSearchFlt?0:P],N=this.hasColDateType?this.colDateType[P]:this.defaultDateType;if(""!==L){var A=h.Str.matchCase(this.getCellData(P,k[P]),this.matchCase),B=L.split(this.orOperator),O=B.length>1?!0:!1,M=L.split(this.anOperator),V=M.length>1?!0:!1;if(O||V){for(var H,U=!1,j=O?B:M,G=0;Gu;u++)if(u===t&&""===l[r].style.display){var f=h.Str.lower(this.getCellData(u,o[u])),g=this.colNbFormat?this.colNbFormat[t]:null,v=e?i(f,g):f;a.push(v)}}return a}}},{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 a=i.indexOf(";",l);-1===a&&(a=i.length),e=unescape(i.substring(l,a))}}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,a=0;a2)return t;var e;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function i(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}if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var l,a;switch(e.toUpperCase()){case"DDMMMYYYY":a=t.replace(/[- \/.]/g," ").split(" "),l=new Date(s(a[2]),i(a[1])-1,a[0]);break;case"DMY":a=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),l=new Date(s(a[2]),a[1]-1,a[0]);break;case"MDY":a=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),l=new Date(s(a[2]),a[0]-1,a[1]);break;case"YMD":a=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),l=new Date(s(a[0]),a[1]-1,a[2]);break;default:a=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),l=new Date(s(a[2]),a[1]-1,a[0])}return l})};e.DateHelper=i},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=a.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=a.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 S=a.Dom.tag(i,"col"),D=0;Dh):U?(u=E(t.replace(d,""),A),a=u>=h):G?(u=E(t.replace(c,""),A),a=h>=u):j?(u=E(t.replace(g,""),A),a=h>u):z?(u=E(t.replace(v,""),A),a=h.toString()!=u.toString()):K?(u=E(t.replace(b,""),A),a=h.toString()==u.toString()):m.test(t)?a=r._containsStr(t.replace(m,""),e,null,!1):F(t,A)?(u=E(t,A),a=h.toString()==u.toString()):O?a=p.Str.isEmpty(e):M&&(a=!p.Str.isEmpty(e));else if(r.hasColNbFormat&&r.colNbFormat[s]?(n=l(e,r.colNbFormat[s]),o=r.colNbFormat[s]):","===r.thousandsSeparator&&"."===r.decimalSeparator?(n=l(e,"us"),o="us"):(n=l(e,"eu"),o="eu"),I)a=n<=l(t.replace(d,""),o);else if(S)a=n>=l(t.replace(c,""),o);else if(k)a=nl(t.replace(g,""),o);else if(D)a=r._containsStr(t.replace(v,""),e)?!1:!0;else if(L)a=r._containsStr(t.replace(m,""),e,null,!1);else if(P)a=r._containsStr(t.replace(b,""),e,null,!0);else if(N)a=0===e.indexOf(t.replace(C,""))?!0:!1;else if(B){var W=t.replace(_,"");a=e.lastIndexOf(W,e.length-1)===e.length-1-(W.length-1)&&e.lastIndexOf(W,e.length-1)>-1?!0:!1}else if(O)a=p.Str.isEmpty(e);else if(M)a=!p.Str.isEmpty(e);else if(V)try{var $=t.replace(T,""),q=new RegExp($);a=q.test(e)}catch(Y){a=!1}else{var J=i["col_"+s];a=r._containsStr(t,e,J?J:r.fltTypeInp)}return a}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this);var s=this.tbl.rows,i=this.cfg,a=0;this.validRowsIndex=[];var r=this;this.highlightKeywords&&this.Cpt.highlightKeyword.unhighlightAll(),this.popUpFilters&&this.Cpt.popupFilter.buildIcons(),this.markActiveColumns&&this.clearActiveColumns(),this.searchArgs=this.getFiltersValue();for(var n,o,d=new RegExp(this.leOperator),c=new RegExp(this.geOperator),f=new RegExp(this.lwOperator),g=new RegExp(this.grOperator),v=new RegExp(this.dfOperator),m=new RegExp(p.Str.rgxEsc(this.lkOperator)),b=new RegExp(this.eqOperator),C=new RegExp(this.stOperator),_=new RegExp(this.enOperator),y=new RegExp(this.anOperator),w=(new RegExp(this.curExp),this.emOperator),x=this.nmOperator,T=new RegExp(p.Str.rgxEsc(this.rgxOperator)),k=this.refRow;kL;L++){var N=this.searchArgs[this.singleSearchFlt?0:L],A=this.hasColDateType?this.colDateType[L]:this.defaultDateType;if(""!==N){var B=p.Str.matchCase(this.getCellData(L,I[L]),this.matchCase),O=N.split(this.orOperator),M=O.length>1?!0:!1,V=N.split(this.anOperator),H=V.length>1?!0:!1;if(M||H){for(var U,j=!1,G=M?O:V,z=0;zd;d++)if(d===t&&""===i[r].style.display){var f=p.Str.lower(this.getCellData(d,o[d])),g=this.colNbFormat?this.colNbFormat[t]:null,v=e?l(f,g):f;a.push(v)}}return a}}},{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 a=i.indexOf(";",l);-1===a&&(a=i.length),e=unescape(i.substring(l,a))}}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,a=0;a2)return t;var e;return 99>=t&&t>50&&(e="19"+t),(50>t||"00"===t)&&(e="20"+t),e}function i(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}if(e||(e="DMY"),!t||""===t)return new Date(1001,0,1);var l,a;switch(e.toUpperCase()){case"DDMMMYYYY":a=t.replace(/[- \/.]/g," ").split(" "),l=new Date(s(a[2]),i(a[1])-1,a[0]);break;case"DMY":a=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),l=new Date(s(a[2]),a[1]-1,a[0]);break;case"MDY":a=t.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),l=new Date(s(a[2]),a[0]-1,a[1]);break;case"YMD":a=t.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),l=new Date(s(a[0]),a[1]-1,a[2]);break;default:a=t.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),l=new Date(s(a[2]),a[1]-1,a[0])}return l})};e.DateHelper=i},function(t,e,s){"use strict";var i=s(4),l={ignoreCase:function(t,e){var s=i.Str.lower(t),l=i.Str.lower(e);return l>s?-1:s>l?1:0}};e.Sort=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=a.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=a.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 S=a.Dom.tag(i,"col"),D=0;D',this.popUpDivCssClass=s.popup_div_css_class||"popUpFilter",this.onBeforePopUpOpen=a.Types.isFn(s.on_before_popup_filter_open)?s.on_before_popup_filter_open:null,this.onAfterPopUpOpen=a.Types.isFn(s.on_after_popup_filter_open)?s.on_after_popup_filter_open:null,this.onBeforePopUpClose=a.Types.isFn(s.on_before_popup_filter_close)?s.on_before_popup_filter_close:null,this.onAfterPopUpClose=a.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 a=this.popUpFltElms[l],h=this.tf.getHeaderElement(l),p=.95*h.clientWidth;if(o.Helpers.isIE()){var d=r.Dom.position(h).left;a.style.left=d+"px"}a.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;sy;y++)if(t===y&&(!e||e&&l.disableExcludedOptions)||t==y&&e&&(""===d[b].style.display&&!l.paging||l.paging&&(!l.validRowsIndex||l.validRowsIndex&&r.Arr.has(l.validRowsIndex,b))&&(void 0===u||u==t||u!=t&&r.Arr.has(l.validRowsIndex,b)))){var w=l.getCellData(y,C[y]),x=n.Str.matchCase(w,c);if(r.Arr.has(this.opts,x,c)||this.opts.push(w),e&&l.disableExcludedOptions){var T=m[y];T||(T=this.GetFilteredDataCol(y)),r.Arr.has(T,x,c)||r.Arr.has(v,x,c)||this.isFirstLoad||v.push(w)}}}if(this.isCustom){var k=l.__getCustomValues(t);this.opts=k[0],this.optsTxt=k[1]}if(l.sortSlc&&!this.isCustom&&(c?(this.opts.sort(),v&&v.sort()):(this.opts.sort(o.Sort.ignoreCase),v&&v.sort(o.Sort.ignoreCase))),l.sortNumAsc&&r.Arr.has(l.sortNumAsc,t))try{this.opts.sort(numSortAsc),v&&v.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(I){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}if(l.sortNumDesc&&r.Arr.has(l.sortNumDesc,t))try{this.opts.sort(numSortDesc),v&&v.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(I){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,p,e,v,f,g)}}},{key:"addOptions",value:function(t,e,s,i,l,o){var h=this.tf,p=n.Str.lower(this.slcFillingMethod),d=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var c=0;c"+f+""}else{var m;m=h.fillSlcOnDemand&&d===this.opts[c]&&h["col"+t]===h.fltTypeSlc?a.Dom.createOpt(f,u,!0):h["col"+t]!==h.fltTypeMulti?a.Dom.createOpt(f,u," "!==l[t]&&u===l[t]?!0:!1):a.Dom.createOpt(f,u,r.Arr.has(o,n.Str.matchCase(this.opts[c],h.matchCase),h.matchCase)||-1!==o.toString().indexOf(u)?!0:!1),g&&(m.disabled=!0),e.appendChild(m)}}"innerhtml"===p&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,s=n.Str.lower(this.slcFillingMethod);if("innerhtml"===s)this.slcInnerHtml+='";else{var i=a.Dom.createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(i.style.display="none"),t.appendChild(i),e.enableEmptyOption){var l=a.Dom.createOpt(e.emptyText,e.emOperator);t.appendChild(l)}if(e.enableNonEmptyOption){var r=a.Dom.createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(r)}}return t}}]),t}();e.Dropdown=h},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;s_;_++)if(t===_&&(!l.refreshFilters||l.refreshFilters&&l.disableExcludedOptions)||t===_&&l.refreshFilters&&(""===u[m].style.display&&!l.paging||l.paging&&(!f||f===t||f!=t&&r.Arr.has(l.validRowsIndex,m)))){var y=l.getCellData(_,b[_]),w=n.Str.matchCase(y,l.matchCase);r.Arr.has(this.opts,w,l.matchCase)||this.opts.push(y);var x=v[_];l.refreshFilters&&l.disableExcludedOptions&&(x||(v[_]=l.GetFilteredDataCol(_)),r.Arr.has(x,w,l.matchCase)||r.Arr.has(g,w,l.matchCase)||l.isFirstLoad||g.push(y))}}if(this.isCustom){var T=l.__getCustomValues(t);this.opts=T[0],this.optsTxt=T[1]}if(l.sortSlc&&!this.isCustom&&(l.matchCase?(this.opts.sort(),g&&g.sort()):(this.opts.sort(o.Sort.ignoreCase),g&&g.sort(o.Sort.ignoreCase))),l.sortNumAsc&&r.Arr.has(l.sortNumAsc,t))try{this.opts.sort(numSortAsc),g&&g.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(k){this.opts.sort(),g&&g.sort(),this.isCustom&&this.optsTxt.sort()}if(l.sortNumDesc&&r.Arr.has(l.sortNumDesc,t))try{this.opts.sort(numSortDesc),g&&g.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(k){this.opts.sort(),g&&g.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,c,l.separator),l.fillSlcOnDemand&&(d.innerHTML=""),d.appendChild(c),d.setAttribute("filled","1")}}},{key:"addChecks",value:function(t,e,s){var i=this,l=this.tf,o=this.addTChecks(t,e),p=[],d=l.Cpt.store,c=d?d.getFilterValues(l.fltsValuesCookie)[t]:null;c&&n.Str.trim(c).length>0&&(l.hasCustomSlcOptions&&r.Arr.has(l.customSlcOptions.cols,t)?p.push(c):p=c.split(" "+l.orOperator+" "));for(var u=0;u0?1:0),a=l+i.pagingLength-1<=e.nbVisibleRows?l+i.pagingLength-1:e.nbVisibleRows;s=l+this.fromToTextSeparator+a+this.overText+e.nbVisibleRows}}else s=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows-(e.hasVisibleRows?e.visibleRows.length:0);this.rowsCounterSpan.innerHTML=s,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,s)}}},{key:"destroy",value:function(){var t=this.tf;t.hasGrid()&&this.rowsCounterSpan&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?n.Helpers.isIE()?this.rowsCounterDiv.outerHTML="":this.rowsCounterDiv.parentNode.removeChild(this.rowsCounterDiv):a.Dom.id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null)}}]),t}();e.RowsCounter=o},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;s",this.btnPrevPageText=s.btn_prev_page_text||"<",this.btnLastPageText=s.btn_last_page_text||">|",this.btnFirstPageText=s.btn_first_page_text||"|<",this.btnNextPageHtml=s.btn_next_page_html||(e.enableIcons?'':null),this.btnPrevPageHtml=s.btn_prev_page_html||(e.enableIcons?'':null),this.btnFirstPageHtml=s.btn_first_page_html||(e.enableIcons?'':null),this.btnLastPageHtml=s.btn_last_page_html||(e.enableIcons?'':null),this.pageText=s.page_text||" Page ",this.ofText=s.of_text||" of ",this.nbPgSpanCssClass=s.nb_pages_css_class||"nbpg",this.hasPagingBtns=s.paging_btns===!1?!1:!0,this.pageSelectorType=s.page_selector_type||e.fltTypeSlc,this.onBeforeChangePage=r.Types.isFn(s.on_before_change_page)?s.on_before_change_page:null,this.onAfterChangePage=r.Types.isFn(s.on_after_change_page)?s.on_after_change_page:null,this.prfxSlcPages="slcPages_",this.prfxSlcResults="slcResults_",this.prfxSlcResultsTxt="slcResultsTxt_",this.prfxBtnNextSpan="btnNextSpan_",this.prfxBtnPrevSpan="btnPrevSpan_",this.prfxBtnLastSpan="btnLastSpan_",this.prfxBtnFirstSpan="btnFirstSpan_",this.prfxBtnNext="btnNext_",this.prfxBtnPrev="btnPrev_",this.prfxBtnLast="btnLast_",this.prfxBtnFirst="btnFirst_",this.prfxPgSpan="pgspan_",this.prfxPgBeforeSpan="pgbeforespan_",this.prfxPgAfterSpan="pgafterspan_";var l=this.refRow,a=this.nbRows;this.nbPages=Math.ceil((a-l)/this.pagingLength);var n=this;this.evt={slcIndex:function(){return n.pageSelectorType===e.fltTypeSlc?n.pagingSlc.options.selectedIndex:parseInt(n.pagingSlc.value,10)-1},nbOpts:function(){return n.pageSelectorType===e.fltTypeSlc?parseInt(n.pagingSlc.options.length,10)-1:n.nbPages-1},next:function(){var t=n.evt.slcIndex()0?n.evt.slcIndex()-1:n.evt.nbOpts();n.changePage(t)},last:function(){n.changePage(n.evt.nbOpts())},first:function(){n.changePage(0)},_detectKey:function(t){var s=o.Event.keyCode(t);13===s&&(e.sorted?(e.filter(),n.changePage(n.evt.slcIndex())):n.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},this.tf=e}return l(t,[{key:"init",value:function(){var t,e=this,s=this.tf,i=this.evt;this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),i.slcPagesChange=function(t){e.changePage(),t.target.blur()},this.pageSelectorType===s.fltTypeSlc&&(t=a.Dom.create(s.fltTypeSlc,["id",this.prfxSlcPages+s.id]),t.className=this.pgSlcCssClass,o.Event.add(t,"change",i.slcPagesChange)),this.pageSelectorType===s.fltTypeInp&&(t=a.Dom.create(s.fltTypeInp,["id",this.prfxSlcPages+s.id],["value",this.currentPageNb]),t.className=this.pgInpCssClass,o.Event.add(t,"keypress",i._detectKey));var l=a.Dom.create("span",["id",this.prfxBtnNextSpan+s.id]),r=a.Dom.create("span",["id",this.prfxBtnPrevSpan+s.id]),n=a.Dom.create("span",["id",this.prfxBtnLastSpan+s.id]),h=a.Dom.create("span",["id",this.prfxBtnFirstSpan+s.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)l.innerHTML=this.btnNextPageHtml,o.Event.add(l,"click",i.next);else{var p=a.Dom.create(s.fltTypeInp,["id",this.prfxBtnNext+s.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);p.className=this.btnPageCssClass,o.Event.add(p,"click",i.next),l.appendChild(p)}if(this.btnPrevPageHtml)r.innerHTML=this.btnPrevPageHtml,o.Event.add(r,"click",i.prev);else{var d=a.Dom.create(s.fltTypeInp,["id",this.prfxBtnPrev+s.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);d.className=this.btnPageCssClass,o.Event.add(d,"click",i.prev),r.appendChild(d)}if(this.btnLastPageHtml)n.innerHTML=this.btnLastPageHtml,o.Event.add(n,"click",i.last);else{var c=a.Dom.create(s.fltTypeInp,["id",this.prfxBtnLast+s.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);c.className=this.btnPageCssClass,o.Event.add(c,"click",i.last),n.appendChild(c)}if(this.btnFirstPageHtml)h.innerHTML=this.btnFirstPageHtml,o.Event.add(h,"click",i.first);else{var u=a.Dom.create(s.fltTypeInp,["id",this.prfxBtnFirst+s.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);u.className=this.btnPageCssClass,o.Event.add(u,"click",i.first),h.appendChild(u)}}this.pagingTgtId||s.setToolbar();var f=this.pagingTgtId?a.Dom.id(this.pagingTgtId):s.mDiv;f.appendChild(h),f.appendChild(r);var g=a.Dom.create("span",["id",this.prfxPgBeforeSpan+s.id]);g.appendChild(a.Dom.text(this.pageText)),g.className=this.nbPgSpanCssClass,f.appendChild(g),f.appendChild(t);var v=a.Dom.create("span",["id",this.prfxPgAfterSpan+s.id]);v.appendChild(a.Dom.text(this.ofText)),v.className=this.nbPgSpanCssClass,f.appendChild(v);var m=a.Dom.create("span",["id",this.prfxPgSpan+s.id]);m.className=this.nbPgSpanCssClass,m.appendChild(a.Dom.text(" "+this.nbPages+" ")),f.appendChild(m),f.appendChild(l),f.appendChild(n),this.pagingSlc=a.Dom.id(this.prfxSlcPages+s.id),(!s.rememberGridValues||this.isPagingRemoved)&&this.setPagingInfo(),s.fltGrid||(s.ValidateAllRows(),this.setPagingInfo(s.validRowsIndex)),this.isPagingRemoved=!1}},{key:"addPaging",value:function(){var t=void 0===arguments[0]?!1:arguments[0],e=this.tf;e.hasGrid()&&!e.paging&&(e.paging=!0,this.isPagingRemoved=!0,this.init(),e.resetValues(),t&&e.filter())}},{key:"setPagingInfo",value:function(t){var e=this.tf,s=e.tbl.rows,i=this.pagingTgtId?a.Dom.id(this.pagingTgtId):e.mDiv,l=a.Dom.id(this.prfxPgSpan+e.id);if(t&&t.length>0)e.validRowsIndex=t;else{e.validRowsIndex=[];for(var r=e.refRow;r0)if(i.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var h=0;h=this.startPagingRow&&i>l?("true"!==a.getAttribute("validRow")&&a.getAttribute("validRow")||(a.style.display=""),e.alternateBgs&&e.Cpt.alternateRows&&e.Cpt.alternateRows.setRowBg(e.validRowsIndex[l],l)):(a.style.display="none",e.alternateBgs&&e.Cpt.alternateRows&&e.Cpt.alternateRows.removeRowBg(e.validRowsIndex[l]))}e.nbVisibleRows=e.validRowsIndex.length,e.isStartBgAlternate=!1,e.applyGridProps()}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&e.paging){var s=this.evt,i=typeof t;if("string"===i)switch(n.Str.lower(t)){case"next":s.next();break;case"previous":s.prev();break;case"last":s.last();break;case"first":s.first();break;default:s.next()}else"number"===i&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,s=this.evt;if((e.hasGrid()||e.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){s.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var i=a.Dom.create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);i.className=e.resultsSlcCssClass; - -var l=this.resultsPerPage[0],r=this.resultsPerPage[1],n=a.Dom.create("span",["id",this.prfxSlcResultsTxt+e.id]);n.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var h=this.resultsPerPageTgtId?a.Dom.id(this.resultsPerPageTgtId):e.rDiv;n.appendChild(a.Dom.text(l)),h.appendChild(n),h.appendChild(i),this.resultsPerPageSlc=a.Dom.id(this.prfxSlcResults+e.id);for(var p=0;p=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.Cpt.store.savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)))}},{key:"_changeResultsPerPage",value:function(){var t=this.tf;if(t.paging){var e=this.resultsPerPageSlc,s=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*s,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var i=this.pagingSlc.options.length-1<=s?this.pagingSlc.options.length-1:s;this.pagingSlc.options[i].selected=!0}t.rememberPageLen&&t.Cpt.store.savePageLength(t.pgLenCookie)}}}},{key:"_resetPage",value:function(t){var e=this.tf,s=e.Cpt.store.getPageNb(t);""!==s&&this.changePage(s-1)}},{key:"_resetPageLength",value:function(t){var e=this.tf;if(e.paging){var s=e.Cpt.store.getPageLength(t);""!==s&&(this.resultsPerPageSlc.options[s].selected=!0,this.changeResultsPerPage())}}},{key:"destroy",value:function(){var t=this.tf;if(t.hasGrid()){var e,s,i,l,r,n,h;e=a.Dom.id(this.prfxBtnNextSpan+t.id),s=a.Dom.id(this.prfxBtnPrevSpan+t.id),i=a.Dom.id(this.prfxBtnLastSpan+t.id),l=a.Dom.id(this.prfxBtnFirstSpan+t.id),r=a.Dom.id(this.prfxPgBeforeSpan+t.id),n=a.Dom.id(this.prfxPgAfterSpan+t.id),h=a.Dom.id(this.prfxPgSpan+t.id);var p=this.evt;this.pagingSlc&&(this.pageSelectorType===t.fltTypeSlc?o.Event.remove(this.pagingSlc,"change",p.slcPagesChange):this.pageSelectorType===t.fltTypeInp&&o.Event.remove(this.pagingSlc,"keypress",p._detectKey),this.pagingSlc.parentNode.removeChild(this.pagingSlc)),e&&(o.Event.remove(e,"click",p.next),e.parentNode.removeChild(e)),s&&(o.Event.remove(s,"click",p.prev),s.parentNode.removeChild(s)),i&&(o.Event.remove(i,"click",p.last),i.parentNode.removeChild(i)),l&&(o.Event.remove(l,"click",p.first),l.parentNode.removeChild(l)),r&&r.parentNode.removeChild(r),n&&n.parentNode.removeChild(n),h&&h.parentNode.removeChild(h),this.hasResultsPerPage&&this.removeResultsPerPage(),this.pagingSlc=null,this.nbPages=0,this.isPagingRemoved=!0,t.paging=!1}}}]),t}();e.Paging=h},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;s':null),this.prfxResetSpan="resetspan_",this.tf=e}return l(t,[{key:"onClick",value:function(){this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(e.hasGrid()||e.isFirstLoad||!e.btnResetEl){var s=a.Dom.create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var i=this.btnResetTgtId?a.Dom.id(this.btnResetTgtId):e.rDiv;if(i.appendChild(s),this.btnResetHtml){s.innerHTML=this.btnResetHtml;var l=s.firstChild;r.Event.add(l,"click",function(){t.onClick()})}else{var n=a.Dom.create("a",["href","javascript:void(0);"]);n.className=e.btnResetCssClass,n.appendChild(a.Dom.text(this.btnResetText)),s.appendChild(n),r.Event.add(n,"click",function(){t.onClick()})}this.btnResetEl=s.firstChild}}},{key:"destroy",value:function(){var t=this.tf;if(t.hasGrid()&&this.btnResetEl){var e=a.Dom.id(t.prfxResetSpan+t.id);e&&e.parentNode.removeChild(e),this.btnResetEl=null}}}]),t}();e.ClearButton=n},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;s<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
These operators are described here:
http://tablefilter.free.fr/#operators
',this.helpInstrHtml=s.help_instructions_html||null,this.helpInstrBtnText=s.help_instructions_btn_text||"?",this.helpInstrBtnHtml=s.help_instructions_btn_html||null,this.helpInstrBtnCssClass=s.help_instructions_btn_css_class||"helpBtn",this.helpInstrContCssClass=s.help_instructions_container_css_class||"helpCont",this.helpInstrBtnEl=null,this.helpInstrContEl=null,this.helpInstrDefaultHtml='

HTML Table Filter Generator v. '+e.version+'

http://tablefilter.free.fr
©2009-'+e.year+' Max Guglielmi.
',this.prfxHelpSpan="helpSpan_",this.prfxHelpDiv="helpDiv_",this.tf=e}return l(t,[{key:"init",value:function(){var t=this;if(!this.helpInstrBtnEl){var e=this.tf,s=a.Dom.create("span",["id",this.prfxHelpSpan+e.id]),i=a.Dom.create("div",["id",this.prfxHelpDiv+e.id]);this.helpInstrTgtId||e.setToolbar();var l=this.helpInstrTgtId?a.Dom.id(this.helpInstrTgtId):e.rDiv;l.appendChild(s);var n=this.helpInstrContTgtId?a.Dom.id(this.helpInstrContTgtId):s;if(this.helpInstrBtnHtml){s.innerHTML=this.helpInstrBtnHtml;var o=s.firstChild;r.Event.add(o,"click",function(){t.toggle()}),n.appendChild(i)}else{n.appendChild(i);var h=a.Dom.create("a",["href","javascript:void(0);"]);h.className=this.helpInstrBtnCssClass,h.appendChild(a.Dom.text(this.helpInstrBtnText)),s.appendChild(h),r.Event.add(h,"click",function(){t.toggle()})}this.helpInstrHtml?(this.helpInstrContTgtId&&n.appendChild(i),i.innerHTML=this.helpInstrHtml,this.helpInstrContTgtId||(i.className=this.helpInstrContCssClass,r.Event.add(i,"dblclick",function(){t.toggle()}))):(i.innerHTML=this.helpInstrText,i.className=this.helpInstrContCssClass,r.Event.add(i,"dblclick",function(){t.toggle()})),i.innerHTML+=this.helpInstrDefaultHtml,r.Event.add(i,"click",function(){t.toggle()}),this.helpInstrContEl=i,this.helpInstrBtnEl=s}}},{key:"toggle",value:function(){if(this.helpInstrContEl){var t=this.helpInstrContEl.style.display;if(""===t||"none"===t){this.helpInstrContEl.style.display="block";var e=a.Dom.position(this.helpInstrBtnEl).left;this.helpInstrContTgtId||(this.helpInstrContEl.style.left=e-this.helpInstrContEl.clientWidth+25+"px")}else this.helpInstrContEl.style.display="none"}}},{key:"destroy",value:function(){this.helpInstrBtnEl&&(this.helpInstrBtnEl.parentNode.removeChild(this.helpInstrBtnEl),this.helpInstrBtnEl=null,this.helpInstrContEl&&(this.helpInstrContEl.parentNode.removeChild(this.helpInstrContEl),this.helpInstrContEl=null))}}]),t}();e.Help=n},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;sl;l++){var a=t?l:this.tf.validRowsIndex[l];this.setRowBg(a,i),i++}}},{key:"setRowBg",value:function(t,e){if(this.tf.alternateBgs&&!isNaN(t)){var s=this.tf.tbl.rows,i=e?e:t;this.removeRowBg(t),a.Dom.addClass(s[t],i%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;a.Dom.removeClass(e[t],this.oddCss),a.Dom.removeClass(e[t],this.evenCss)}}},{key:"remove",value:function(){if(this.tf.hasGrid()){for(var t=(this.tf.tbl.rows,this.tf.refRow);t=jj;jj++)ucolIndex[jj]===colIndex[ii]&&(saved=1);0===saved&&(ucolMax++,ucolIndex[ucolMax]=colIndex[ii])}if("object"==_Str.Str.lower(typeof labelId)&&"object"==_Str.Str.lower(typeof colIndex)&&"object"==_Str.Str.lower(typeof operation))for(var row=this.tf.tbl.rows,colvalues=[],ucol=0;ucolMax>=ucol;ucol++){colvalues.push(this.tf.getColValues(ucolIndex[ucol],!0,excludeRow));for(var result,nbvalues=0,temp,meanValue=0,sumValue=0,minValue=null,maxValue=null,q1Value=null,medValue=null,q3Value=null,meanFlag=0,sumFlag=0,minFlag=0,maxFlag=0,q1Flag=0,medFlag=0,q3Flag=0,theList=[],opsThisCol=[],decThisCol=[],labThisCol=[],oTypeThisCol=[],mThisCol=-1,k=0;kmaxValue?parseFloat(cvalue):maxValue))}if(1===meanFlag&&(meanValue=sumValue/nbvalues),1===medFlag){var aux=0;nbvalues%2===1?(aux=Math.floor(nbvalues/2),medValue=theList[aux]):medValue=(theList[nbvalues/2]+theList[nbvalues/2-1])/2}var posa;if(1===q1Flag&&(posa=0,posa=Math.floor(nbvalues/4),q1Value=4*posa==nbvalues?(theList[posa-1]+theList[posa])/2:theList[posa]),1===q3Flag){posa=0;var posb=0;posa=Math.floor(nbvalues/4),4*posa===nbvalues?(posb=3*posa,q3Value=(theList[posb]+theList[posb-1])/2):q3Value=theList[nbvalues-posa-1]}for(var i=0;mThisCol>=i;i++){switch(opsThisCol[i]){case"mean":result=meanValue;break;case"sum":result=sumValue;break;case"min":result=minValue;break;case"max":result=maxValue;break;case"median":result=medValue;break;case"q1":result=q1Value;break;case"q3":result=q3Value}var precision=isNaN(decThisCol[i])?2:decThisCol[i];if(oTypeThisCol&&result){if(result=result.toFixed(precision),_Dom.Dom.id(labThisCol[i]))switch(_Str.Str.lower(oTypeThisCol)){case"innerhtml":isNaN(result)||!isFinite(result)||0===nbvalues?_Dom.Dom.id(labThisCol[i]).innerHTML=".":_Dom.Dom.id(labThisCol[i]).innerHTML=result;break;case"setvalue":_Dom.Dom.id(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=_Dom.Dom.id(labThisCol[i]).firstChild,txtnode=_Dom.Dom.text(result);_Dom.Dom.id(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{isNaN(result)||!isFinite(result)||0===nbvalues?_Dom.Dom.id(labThisCol[i]).innerHTML=".":_Dom.Dom.id(labThisCol[i]).innerHTML=result.toFixed(precision)}catch(e){}}var totRow=totRowIndex&&totRowIndex[ucol]?row[totRowIndex[ucol]]:null;totRow&&(totRow.style.display="")}this.onAfterOperation&&this.onAfterOperation.call(null,this.tf)}}}]),ColOps}();exports.ColOps=ColOps}])}); \ No newline at end of file +},i="none"===t?this.loaderCloseDelay:1;n.setTimeout(s,i)}}},{key:"remove",value:function(){if(this.loaderDiv){var t=this.tf,e=this.loaderTgtId?a.Dom.id(this.loaderTgtId):t.gridLayout?t.Cpt.gridLayout.tblCont:t.tbl.parentNode;e.removeChild(this.loaderDiv),this.loaderDiv=null}}}]),t}();e.Loader=o},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;s',this.popUpDivCssClass=s.popup_div_css_class||"popUpFilter",this.onBeforePopUpOpen=a.Types.isFn(s.on_before_popup_filter_open)?s.on_before_popup_filter_open:null,this.onAfterPopUpOpen=a.Types.isFn(s.on_after_popup_filter_open)?s.on_after_popup_filter_open:null,this.onBeforePopUpClose=a.Types.isFn(s.on_before_popup_filter_close)?s.on_before_popup_filter_close:null,this.onAfterPopUpClose=a.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 a=this.popUpFltElms[l],h=this.tf.getHeaderElement(l),p=.95*h.clientWidth;if(o.Helpers.isIE()){var d=r.Dom.position(h).left;a.style.left=d+"px"}a.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;sy;y++)if(t===y&&(!e||e&&l.disableExcludedOptions)||t==y&&e&&(""===d[C].style.display&&!l.paging||l.paging&&(!l.validRowsIndex||l.validRowsIndex&&r.Arr.has(l.validRowsIndex,C))&&(void 0===u||u==t||u!=t&&r.Arr.has(l.validRowsIndex,C)))){var w=l.getCellData(y,b[y]),x=n.Str.matchCase(w,c);if(r.Arr.has(this.opts,x,c)||this.opts.push(w),e&&l.disableExcludedOptions){var T=m[y];T||(T=this.GetFilteredDataCol(y)),r.Arr.has(T,x,c)||r.Arr.has(v,x,c)||this.isFirstLoad||v.push(w)}}}if(this.isCustom){var k=l.__getCustomValues(t);this.opts=k[0],this.optsTxt=k[1]}if(l.sortSlc&&!this.isCustom&&(c?(this.opts.sort(),v&&v.sort()):(this.opts.sort(o.Sort.ignoreCase),v&&v.sort(o.Sort.ignoreCase))),l.sortNumAsc&&r.Arr.has(l.sortNumAsc,t))try{this.opts.sort(numSortAsc),v&&v.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(I){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}if(l.sortNumDesc&&r.Arr.has(l.sortNumDesc,t))try{this.opts.sort(numSortDesc),v&&v.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(I){this.opts.sort(),v&&v.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(t,p,e,v,f,g)}}},{key:"addOptions",value:function(t,e,s,i,l,o){var h=this.tf,p=n.Str.lower(this.slcFillingMethod),d=e.value;e.innerHTML="",e=this.addFirstOption(e);for(var c=0;c"+f+""}else{var m;m=h.fillSlcOnDemand&&d===this.opts[c]&&h["col"+t]===h.fltTypeSlc?a.Dom.createOpt(f,u,!0):h["col"+t]!==h.fltTypeMulti?a.Dom.createOpt(f,u," "!==l[t]&&u===l[t]?!0:!1):a.Dom.createOpt(f,u,r.Arr.has(o,n.Str.matchCase(this.opts[c],h.matchCase),h.matchCase)||-1!==o.toString().indexOf(u)?!0:!1),g&&(m.disabled=!0),e.appendChild(m)}}"innerhtml"===p&&(e.innerHTML+=this.slcInnerHtml),e.setAttribute("filled","1")}},{key:"addFirstOption",value:function(t){var e=this.tf,s=n.Str.lower(this.slcFillingMethod);if("innerhtml"===s)this.slcInnerHtml+='";else{var i=a.Dom.createOpt(this.enableSlcResetFilter?e.displayAllText:"","");if(this.enableSlcResetFilter||(i.style.display="none"),t.appendChild(i),e.enableEmptyOption){var l=a.Dom.createOpt(e.emptyText,e.emOperator);t.appendChild(l)}if(e.enableNonEmptyOption){var r=a.Dom.createOpt(e.nonEmptyText,e.nmOperator);t.appendChild(r)}}return t}}]),t}();e.Dropdown=h},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;s_;_++)if(t===_&&(!l.refreshFilters||l.refreshFilters&&l.disableExcludedOptions)||t===_&&l.refreshFilters&&(""===u[m].style.display&&!l.paging||l.paging&&(!f||f===t||f!=t&&r.Arr.has(l.validRowsIndex,m)))){var y=l.getCellData(_,C[_]),w=n.Str.matchCase(y,l.matchCase);r.Arr.has(this.opts,w,l.matchCase)||this.opts.push(y);var x=v[_];l.refreshFilters&&l.disableExcludedOptions&&(x||(v[_]=l.GetFilteredDataCol(_)),r.Arr.has(x,w,l.matchCase)||r.Arr.has(g,w,l.matchCase)||l.isFirstLoad||g.push(y))}}if(this.isCustom){var T=l.__getCustomValues(t);this.opts=T[0],this.optsTxt=T[1]}if(l.sortSlc&&!this.isCustom&&(l.matchCase?(this.opts.sort(),g&&g.sort()):(this.opts.sort(o.Sort.ignoreCase),g&&g.sort(o.Sort.ignoreCase))),l.sortNumAsc&&r.Arr.has(l.sortNumAsc,t))try{this.opts.sort(numSortAsc),g&&g.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(k){this.opts.sort(),g&&g.sort(),this.isCustom&&this.optsTxt.sort()}if(l.sortNumDesc&&r.Arr.has(l.sortNumDesc,t))try{this.opts.sort(numSortDesc),g&&g.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(k){this.opts.sort(),g&&g.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(t,c,l.separator),l.fillSlcOnDemand&&(d.innerHTML=""),d.appendChild(c),d.setAttribute("filled","1")}}},{key:"addChecks",value:function(t,e){var s=this,i=this.tf,l=this.addTChecks(t,e),o=[],p=i.Cpt.store,d=p?p.getFilterValues(i.fltsValuesCookie)[t]:null;d&&n.Str.trim(d).length>0&&(i.hasCustomSlcOptions&&r.Arr.has(i.customSlcOptions.cols,t)?o.push(d):o=d.split(" "+i.orOperator+" "));for(var c=0;c0?1:0),a=l+i.pagingLength-1<=e.nbVisibleRows?l+i.pagingLength-1:e.nbVisibleRows;s=l+this.fromToTextSeparator+a+this.overText+e.nbVisibleRows}}else s=t&&""!==t?t:e.nbFilterableRows-e.nbHiddenRows-(e.hasVisibleRows?e.visibleRows.length:0);this.rowsCounterSpan.innerHTML=s,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,e,this.rowsCounterSpan,s)}}},{key:"destroy",value:function(){var t=this.tf;t.hasGrid()&&this.rowsCounterSpan&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?n.Helpers.isIE()?this.rowsCounterDiv.outerHTML="":this.rowsCounterDiv.parentNode.removeChild(this.rowsCounterDiv):a.Dom.id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null)}}]),t}();e.RowsCounter=o},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;s",this.btnPrevPageText=s.btn_prev_page_text||"<",this.btnLastPageText=s.btn_last_page_text||">|",this.btnFirstPageText=s.btn_first_page_text||"|<",this.btnNextPageHtml=s.btn_next_page_html||(e.enableIcons?'':null),this.btnPrevPageHtml=s.btn_prev_page_html||(e.enableIcons?'':null),this.btnFirstPageHtml=s.btn_first_page_html||(e.enableIcons?'':null),this.btnLastPageHtml=s.btn_last_page_html||(e.enableIcons?'':null),this.pageText=s.page_text||" Page ",this.ofText=s.of_text||" of ",this.nbPgSpanCssClass=s.nb_pages_css_class||"nbpg",this.hasPagingBtns=s.paging_btns===!1?!1:!0,this.pageSelectorType=s.page_selector_type||e.fltTypeSlc,this.onBeforeChangePage=r.Types.isFn(s.on_before_change_page)?s.on_before_change_page:null,this.onAfterChangePage=r.Types.isFn(s.on_after_change_page)?s.on_after_change_page:null,this.prfxSlcPages="slcPages_",this.prfxSlcResults="slcResults_",this.prfxSlcResultsTxt="slcResultsTxt_",this.prfxBtnNextSpan="btnNextSpan_",this.prfxBtnPrevSpan="btnPrevSpan_",this.prfxBtnLastSpan="btnLastSpan_",this.prfxBtnFirstSpan="btnFirstSpan_",this.prfxBtnNext="btnNext_",this.prfxBtnPrev="btnPrev_",this.prfxBtnLast="btnLast_",this.prfxBtnFirst="btnFirst_",this.prfxPgSpan="pgspan_",this.prfxPgBeforeSpan="pgbeforespan_",this.prfxPgAfterSpan="pgafterspan_";var l=this.refRow,a=this.nbRows;this.nbPages=Math.ceil((a-l)/this.pagingLength);var n=this;this.evt={slcIndex:function(){return n.pageSelectorType===e.fltTypeSlc?n.pagingSlc.options.selectedIndex:parseInt(n.pagingSlc.value,10)-1},nbOpts:function(){return n.pageSelectorType===e.fltTypeSlc?parseInt(n.pagingSlc.options.length,10)-1:n.nbPages-1},next:function(){var t=n.evt.slcIndex()0?n.evt.slcIndex()-1:n.evt.nbOpts();n.changePage(t)},last:function(){n.changePage(n.evt.nbOpts())},first:function(){n.changePage(0)},_detectKey:function(t){var s=o.Event.keyCode(t);13===s&&(e.sorted?(e.filter(),n.changePage(n.evt.slcIndex())):n.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},this.tf=e}return l(t,[{key:"init",value:function(){var t,e=this,s=this.tf,i=this.evt;this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),i.slcPagesChange=function(t){e.changePage(),t.target.blur()},this.pageSelectorType===s.fltTypeSlc&&(t=a.Dom.create(s.fltTypeSlc,["id",this.prfxSlcPages+s.id]),t.className=this.pgSlcCssClass,o.Event.add(t,"change",i.slcPagesChange)),this.pageSelectorType===s.fltTypeInp&&(t=a.Dom.create(s.fltTypeInp,["id",this.prfxSlcPages+s.id],["value",this.currentPageNb]),t.className=this.pgInpCssClass,o.Event.add(t,"keypress",i._detectKey));var l=a.Dom.create("span",["id",this.prfxBtnNextSpan+s.id]),r=a.Dom.create("span",["id",this.prfxBtnPrevSpan+s.id]),n=a.Dom.create("span",["id",this.prfxBtnLastSpan+s.id]),h=a.Dom.create("span",["id",this.prfxBtnFirstSpan+s.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)l.innerHTML=this.btnNextPageHtml,o.Event.add(l,"click",i.next);else{var p=a.Dom.create(s.fltTypeInp,["id",this.prfxBtnNext+s.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);p.className=this.btnPageCssClass,o.Event.add(p,"click",i.next),l.appendChild(p)}if(this.btnPrevPageHtml)r.innerHTML=this.btnPrevPageHtml,o.Event.add(r,"click",i.prev);else{var d=a.Dom.create(s.fltTypeInp,["id",this.prfxBtnPrev+s.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);d.className=this.btnPageCssClass,o.Event.add(d,"click",i.prev),r.appendChild(d)}if(this.btnLastPageHtml)n.innerHTML=this.btnLastPageHtml,o.Event.add(n,"click",i.last);else{var c=a.Dom.create(s.fltTypeInp,["id",this.prfxBtnLast+s.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);c.className=this.btnPageCssClass,o.Event.add(c,"click",i.last),n.appendChild(c)}if(this.btnFirstPageHtml)h.innerHTML=this.btnFirstPageHtml,o.Event.add(h,"click",i.first);else{var u=a.Dom.create(s.fltTypeInp,["id",this.prfxBtnFirst+s.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);u.className=this.btnPageCssClass,o.Event.add(u,"click",i.first),h.appendChild(u)}}this.pagingTgtId||s.setToolbar();var f=this.pagingTgtId?a.Dom.id(this.pagingTgtId):s.mDiv;f.appendChild(h),f.appendChild(r);var g=a.Dom.create("span",["id",this.prfxPgBeforeSpan+s.id]);g.appendChild(a.Dom.text(this.pageText)),g.className=this.nbPgSpanCssClass,f.appendChild(g),f.appendChild(t);var v=a.Dom.create("span",["id",this.prfxPgAfterSpan+s.id]);v.appendChild(a.Dom.text(this.ofText)),v.className=this.nbPgSpanCssClass,f.appendChild(v);var m=a.Dom.create("span",["id",this.prfxPgSpan+s.id]);m.className=this.nbPgSpanCssClass,m.appendChild(a.Dom.text(" "+this.nbPages+" ")),f.appendChild(m),f.appendChild(l),f.appendChild(n),this.pagingSlc=a.Dom.id(this.prfxSlcPages+s.id),(!s.rememberGridValues||this.isPagingRemoved)&&this.setPagingInfo(),s.fltGrid||(s.ValidateAllRows(),this.setPagingInfo(s.validRowsIndex)),this.isPagingRemoved=!1}},{key:"addPaging",value:function(){var t=void 0===arguments[0]?!1:arguments[0],e=this.tf;e.hasGrid()&&!e.paging&&(e.paging=!0,this.isPagingRemoved=!0,this.init(),e.resetValues(),t&&e.filter())}},{key:"setPagingInfo",value:function(t){var e=this.tf,s=e.tbl.rows,i=this.pagingTgtId?a.Dom.id(this.pagingTgtId):e.mDiv,l=a.Dom.id(this.prfxPgSpan+e.id);if(t&&t.length>0)e.validRowsIndex=t;else{e.validRowsIndex=[];for(var r=e.refRow;r0)if(i.style.visibility="visible",this.pageSelectorType===e.fltTypeSlc)for(var h=0;h=this.startPagingRow&&i>l?("true"!==a.getAttribute("validRow")&&a.getAttribute("validRow")||(a.style.display=""),e.alternateBgs&&e.Cpt.alternateRows&&e.Cpt.alternateRows.setRowBg(e.validRowsIndex[l],l)):(a.style.display="none",e.alternateBgs&&e.Cpt.alternateRows&&e.Cpt.alternateRows.removeRowBg(e.validRowsIndex[l]))}e.nbVisibleRows=e.validRowsIndex.length,e.isStartBgAlternate=!1,e.applyGridProps()}},{key:"setPage",value:function(t){var e=this.tf;if(e.hasGrid()&&e.paging){var s=this.evt,i=typeof t;if("string"===i)switch(n.Str.lower(t)){case"next":s.next();break;case"previous":s.prev();break;case"last":s.last();break;case"first":s.first();break;default:s.next()}else"number"===i&&this.changePage(t-1)}}},{key:"setResultsPerPage",value:function(){var t=this,e=this.tf,s=this.evt;if((e.hasGrid()||e.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){s.slcResultsChange=function(e){t.changeResultsPerPage(),e.target.blur()};var i=a.Dom.create(e.fltTypeSlc,["id",this.prfxSlcResults+e.id]);i.className=e.resultsSlcCssClass;var l=this.resultsPerPage[0],r=this.resultsPerPage[1],n=a.Dom.create("span",["id",this.prfxSlcResultsTxt+e.id]);n.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||e.setToolbar();var h=this.resultsPerPageTgtId?a.Dom.id(this.resultsPerPageTgtId):e.rDiv;n.appendChild(a.Dom.text(l)),h.appendChild(n),h.appendChild(i),this.resultsPerPageSlc=a.Dom.id(this.prfxSlcResults+e.id);for(var p=0;p=0&&t<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,t),this.currentPageNb=parseInt(t,10)+1,this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.options[t].selected=!0:this.pagingSlc.value=this.currentPageNb,e.rememberPageNb&&e.Cpt.store.savePageNb(e.pgNbCookie),this.startPagingRow=this.pageSelectorType===e.fltTypeSlc?this.pagingSlc.value:t*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,t)))}},{key:"_changeResultsPerPage",value:function(){var t=this.tf;if(t.paging){var e=this.resultsPerPageSlc,s=this.pageSelectorType===t.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(e.options[e.selectedIndex].value,10),this.startPagingRow=this.pagingLength*s,!isNaN(this.pagingLength)){if(this.startPagingRow>=t.nbFilterableRows&&(this.startPagingRow=t.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===t.fltTypeSlc){var i=this.pagingSlc.options.length-1<=s?this.pagingSlc.options.length-1:s;this.pagingSlc.options[i].selected=!0}t.rememberPageLen&&t.Cpt.store.savePageLength(t.pgLenCookie)}}}},{key:"_resetPage",value:function(t){var e=this.tf,s=e.Cpt.store.getPageNb(t);""!==s&&this.changePage(s-1)}},{key:"_resetPageLength",value:function(t){var e=this.tf;if(e.paging){var s=e.Cpt.store.getPageLength(t);""!==s&&(this.resultsPerPageSlc.options[s].selected=!0,this.changeResultsPerPage())}}},{key:"destroy",value:function(){var t=this.tf;if(t.hasGrid()){var e,s,i,l,r,n,h;e=a.Dom.id(this.prfxBtnNextSpan+t.id),s=a.Dom.id(this.prfxBtnPrevSpan+t.id),i=a.Dom.id(this.prfxBtnLastSpan+t.id),l=a.Dom.id(this.prfxBtnFirstSpan+t.id),r=a.Dom.id(this.prfxPgBeforeSpan+t.id),n=a.Dom.id(this.prfxPgAfterSpan+t.id),h=a.Dom.id(this.prfxPgSpan+t.id);var p=this.evt;this.pagingSlc&&(this.pageSelectorType===t.fltTypeSlc?o.Event.remove(this.pagingSlc,"change",p.slcPagesChange):this.pageSelectorType===t.fltTypeInp&&o.Event.remove(this.pagingSlc,"keypress",p._detectKey),this.pagingSlc.parentNode.removeChild(this.pagingSlc)),e&&(o.Event.remove(e,"click",p.next),e.parentNode.removeChild(e)),s&&(o.Event.remove(s,"click",p.prev),s.parentNode.removeChild(s)),i&&(o.Event.remove(i,"click",p.last),i.parentNode.removeChild(i)),l&&(o.Event.remove(l,"click",p.first),l.parentNode.removeChild(l)),r&&r.parentNode.removeChild(r),n&&n.parentNode.removeChild(n),h&&h.parentNode.removeChild(h),this.hasResultsPerPage&&this.removeResultsPerPage(),this.pagingSlc=null,this.nbPages=0,this.isPagingRemoved=!0,t.paging=!1}}}]),t}();e.Paging=h},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;s':null),this.prfxResetSpan="resetspan_",this.tf=e}return l(t,[{key:"onClick",value:function(){this.tf.clearFilters()}},{key:"init",value:function(){var t=this,e=this.tf;if(e.hasGrid()||e.isFirstLoad||!e.btnResetEl){var s=a.Dom.create("span",["id",this.prfxResetSpan+e.id]);this.btnResetTgtId||e.setToolbar();var i=this.btnResetTgtId?a.Dom.id(this.btnResetTgtId):e.rDiv;if(i.appendChild(s),this.btnResetHtml){s.innerHTML=this.btnResetHtml;var l=s.firstChild;r.Event.add(l,"click",function(){t.onClick()})}else{var n=a.Dom.create("a",["href","javascript:void(0);"]);n.className=e.btnResetCssClass,n.appendChild(a.Dom.text(this.btnResetText)),s.appendChild(n),r.Event.add(n,"click",function(){t.onClick()})}this.btnResetEl=s.firstChild}}},{key:"destroy",value:function(){var t=this.tf;if(t.hasGrid()&&this.btnResetEl){var e=a.Dom.id(t.prfxResetSpan+t.id);e&&e.parentNode.removeChild(e),this.btnResetEl=null}}}]),t}();e.ClearButton=n},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;s<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
These operators are described here:
http://tablefilter.free.fr/#operators
',this.helpInstrHtml=s.help_instructions_html||null,this.helpInstrBtnText=s.help_instructions_btn_text||"?",this.helpInstrBtnHtml=s.help_instructions_btn_html||null,this.helpInstrBtnCssClass=s.help_instructions_btn_css_class||"helpBtn",this.helpInstrContCssClass=s.help_instructions_container_css_class||"helpCont",this.helpInstrBtnEl=null,this.helpInstrContEl=null,this.helpInstrDefaultHtml='

HTML Table Filter Generator v. '+e.version+'

http://tablefilter.free.fr
©2009-'+e.year+' Max Guglielmi.
',this.prfxHelpSpan="helpSpan_",this.prfxHelpDiv="helpDiv_",this.tf=e}return l(t,[{key:"init",value:function(){var t=this;if(!this.helpInstrBtnEl){var e=this.tf,s=a.Dom.create("span",["id",this.prfxHelpSpan+e.id]),i=a.Dom.create("div",["id",this.prfxHelpDiv+e.id]);this.helpInstrTgtId||e.setToolbar();var l=this.helpInstrTgtId?a.Dom.id(this.helpInstrTgtId):e.rDiv;l.appendChild(s);var n=this.helpInstrContTgtId?a.Dom.id(this.helpInstrContTgtId):s;if(this.helpInstrBtnHtml){s.innerHTML=this.helpInstrBtnHtml;var o=s.firstChild;r.Event.add(o,"click",function(){t.toggle()}),n.appendChild(i)}else{n.appendChild(i);var h=a.Dom.create("a",["href","javascript:void(0);"]);h.className=this.helpInstrBtnCssClass,h.appendChild(a.Dom.text(this.helpInstrBtnText)),s.appendChild(h),r.Event.add(h,"click",function(){t.toggle()})}this.helpInstrHtml?(this.helpInstrContTgtId&&n.appendChild(i),i.innerHTML=this.helpInstrHtml,this.helpInstrContTgtId||(i.className=this.helpInstrContCssClass,r.Event.add(i,"dblclick",function(){t.toggle()}))):(i.innerHTML=this.helpInstrText,i.className=this.helpInstrContCssClass,r.Event.add(i,"dblclick",function(){t.toggle()})),i.innerHTML+=this.helpInstrDefaultHtml,r.Event.add(i,"click",function(){t.toggle()}),this.helpInstrContEl=i,this.helpInstrBtnEl=s}}},{key:"toggle",value:function(){if(this.helpInstrContEl){var t=this.helpInstrContEl.style.display;if(""===t||"none"===t){this.helpInstrContEl.style.display="block";var e=a.Dom.position(this.helpInstrBtnEl).left;this.helpInstrContTgtId||(this.helpInstrContEl.style.left=e-this.helpInstrContEl.clientWidth+25+"px")}else this.helpInstrContEl.style.display="none"}}},{key:"destroy",value:function(){this.helpInstrBtnEl&&(this.helpInstrBtnEl.parentNode.removeChild(this.helpInstrBtnEl),this.helpInstrBtnEl=null,this.helpInstrContEl&&(this.helpInstrContEl.parentNode.removeChild(this.helpInstrContEl),this.helpInstrContEl=null))}}]),t}();e.Help=n},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;sl;l++){var a=t?l:this.tf.validRowsIndex[l];this.setRowBg(a,i),i++}}},{key:"setRowBg",value:function(t,e){if(this.tf.alternateBgs&&!isNaN(t)){var s=this.tf.tbl.rows,i=e?e:t;this.removeRowBg(t),a.Dom.addClass(s[t],i%2?this.evenCss:this.oddCss)}}},{key:"removeRowBg",value:function(t){if(!isNaN(t)){var e=this.tf.tbl.rows;a.Dom.removeClass(e[t],this.oddCss),a.Dom.removeClass(e[t],this.evenCss)}}},{key:"remove",value:function(){if(this.tf.hasGrid()){for(var t=this.tf.refRow;t=jj;jj++)ucolIndex[jj]===colIndex[ii]&&(saved=1);0===saved&&(ucolMax++,ucolIndex[ucolMax]=colIndex[ii])}if("object"==_Str.Str.lower(typeof labelId)&&"object"==_Str.Str.lower(typeof colIndex)&&"object"==_Str.Str.lower(typeof operation))for(var row=this.tf.tbl.rows,colvalues=[],ucol=0;ucolMax>=ucol;ucol++){colvalues.push(this.tf.getColValues(ucolIndex[ucol],!0,excludeRow));for(var result,nbvalues=0,temp,meanValue=0,sumValue=0,minValue=null,maxValue=null,q1Value=null,medValue=null,q3Value=null,meanFlag=0,sumFlag=0,minFlag=0,maxFlag=0,q1Flag=0,medFlag=0,q3Flag=0,theList=[],opsThisCol=[],decThisCol=[],labThisCol=[],oTypeThisCol=[],mThisCol=-1,k=0;kmaxValue?parseFloat(cvalue):maxValue))}if(1===meanFlag&&(meanValue=sumValue/nbvalues),1===medFlag){var aux=0;nbvalues%2===1?(aux=Math.floor(nbvalues/2),medValue=theList[aux]):medValue=(theList[nbvalues/2]+theList[nbvalues/2-1])/2}var posa;if(1===q1Flag&&(posa=0,posa=Math.floor(nbvalues/4),q1Value=4*posa==nbvalues?(theList[posa-1]+theList[posa])/2:theList[posa]),1===q3Flag){posa=0;var posb=0;posa=Math.floor(nbvalues/4),4*posa===nbvalues?(posb=3*posa,q3Value=(theList[posb]+theList[posb-1])/2):q3Value=theList[nbvalues-posa-1]}for(var i=0;mThisCol>=i;i++){switch(opsThisCol[i]){case"mean":result=meanValue;break;case"sum":result=sumValue;break;case"min":result=minValue;break;case"max":result=maxValue;break;case"median":result=medValue;break;case"q1":result=q1Value;break;case"q3":result=q3Value}var precision=isNaN(decThisCol[i])?2:decThisCol[i];if(oTypeThisCol&&result){if(result=result.toFixed(precision),_Dom.Dom.id(labThisCol[i]))switch(_Str.Str.lower(oTypeThisCol)){case"innerhtml":isNaN(result)||!isFinite(result)||0===nbvalues?_Dom.Dom.id(labThisCol[i]).innerHTML=".":_Dom.Dom.id(labThisCol[i]).innerHTML=result;break;case"setvalue":_Dom.Dom.id(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=_Dom.Dom.id(labThisCol[i]).firstChild,txtnode=_Dom.Dom.text(result);_Dom.Dom.id(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{isNaN(result)||!isFinite(result)||0===nbvalues?_Dom.Dom.id(labThisCol[i]).innerHTML=".":_Dom.Dom.id(labThisCol[i]).innerHTML=result.toFixed(precision)}catch(e){}}var totRow=totRowIndex&&totRowIndex[ucol]?row[totRowIndex[ucol]]:null;totRow&&(totRow.style.display="")}this.onAfterOperation&&this.onAfterOperation.call(null,this.tf)}}}]),ColOps}();exports.ColOps=ColOps},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=s(4),l={ignoreCase:function(t,e){var s=i.Str.lower(t),l=i.Str.lower(e);return l>s?-1:s>l?1:0}};e.Sort=l}])}); \ No newline at end of file diff --git a/examples/requirejs.html b/examples/requirejs.html index 964693b7..9bd6d9d4 100644 --- a/examples/requirejs.html +++ b/examples/requirejs.html @@ -2,7 +2,6 @@ HTML Table Filter Generator - @@ -93,14 +92,13 @@ - + \ No newline at end of file diff --git a/src-es6/extensions/colsVisibility/colsVisibility.js b/src-es6/extensions/colsVisibility/colsVisibility.js index 608139a8..aa229bb9 100644 --- a/src-es6/extensions/colsVisibility/colsVisibility.js +++ b/src-es6/extensions/colsVisibility/colsVisibility.js @@ -133,8 +133,7 @@ export default class ColsVisibility{ this.tf = tf; } - toggle(evt){ - var tf = this.tf; + toggle(){ var contDisplay = this.contEl.style.display; var onBeforeOpen = this.onBeforeOpen; var onBeforeClose = this.onBeforeClose; @@ -277,7 +276,7 @@ export default class ColsVisibility{ ul.appendChild(li); li.check.checked = !this.tickToHide; - Event.add(li.check, 'click', (evt)=> { + Event.add(li.check, 'click', ()=> { for(var h = 0; h < headerRow.cells.length; h++){ var itm = Dom.id('col_'+h+'_'+tf.id); if(itm && li.check.checked !== itm.checked){ @@ -351,7 +350,6 @@ export default class ColsVisibility{ setHidden(colIndex, hide){ var tf = this.tf; var tbl = tf.tbl; - var col = Dom.tag(tbl, 'col')[colIndex]; if(this.onBeforeColHidden && hide){ this.onBeforeColHidden.call(null, this, colIndex); diff --git a/src-es6/extensions/sort/adapterSortabletable.js b/src-es6/extensions/sort/adapterSortabletable.js index 94b1e63f..2b3c82f7 100644 --- a/src-es6/extensions/sort/adapterSortabletable.js +++ b/src-es6/extensions/sort/adapterSortabletable.js @@ -205,7 +205,6 @@ export default class AdapterSortableTable{ } stt.headersRow = tf.headersRow; var cells = stt.tHead.rows[stt.headersRow].cells; - var doc = stt.tHead.ownerDocument || stt.tHead.document; stt.sortTypes = oSortTypes || []; var l = cells.length; var img, c; diff --git a/src-es6/modules/alternateRows.js b/src-es6/modules/alternateRows.js index 770fd787..fd5d77bf 100644 --- a/src-es6/modules/alternateRows.js +++ b/src-es6/modules/alternateRows.js @@ -23,7 +23,6 @@ export class AlternateRows{ if(!this.tf.hasGrid() && !this.tf.isFirstLoad){ return; } - var rows = this.tf.tbl.rows; var noValidRowsIndex = this.tf.validRowsIndex===null; //1st index var beginIndex = noValidRowsIndex ? this.tf.refRow : 0; @@ -80,7 +79,6 @@ export class AlternateRows{ if(!this.tf.hasGrid()){ return; } - var row = this.tf.tbl.rows; for(var i=this.tf.refRow; i1){ + if(arguments.length > 1){ for(var i=0; i TableFilter column sort with grid layout mode - - @@ -139,7 +133,8 @@
- + +
diff --git a/test/test-sort-grid-layout.js b/test/test-sort-grid-layout.js index 935d258a..92f289ff 100644 --- a/test/test-sort-grid-layout.js +++ b/test/test-sort-grid-layout.js @@ -1,97 +1,89 @@ -requirejs(['test-config', '../src/tablefilter'], function(config, TableFilter){ - var types = require('types').Types, - dom = require('dom').Dom; - - var tf = new TableFilter('demo', { - base_path: '../src/', - sort: true, - sort_config: { - sort_types: ['string','string','number','number','number'] - }, - grid_layout: true, - on_sort_loaded: startSimple - }); - tf.init(); - - var tf1 = new TableFilter('demo2', { - base_path: '../src/', - paging: true, - sort: true, - sort_config: { - sort_types: ['string','string','number','number','number'] - }, - grid_layout: true, - on_sort_loaded: startPaging - }); - tf1.init(); - - QUnit.start(); - - function startSimple(tf){ - var sort = tf.ExtRegistry.sort; - - module('Sanity checks'); - test('Sort extension', function() { - notEqual(sort, null, 'Sort instanciated'); - deepEqual(sort.stt instanceof SortableTable, true, 'Sort type'); - deepEqual(sort.sorted, false, 'Table not sorted'); - }); - - test('Sort behaviour', function() { - var th = tf.getHeaderElement(0); - sort.sortByColumnIndex(0); - - deepEqual(sort.sorted, true, 'Table column sorted'); - deepEqual(sort.isPaged, false, 'Table is not paged'); - }); - - module('Destroy and re-init'); - test('Remove sort', function() { - sort.destroy(); - var th = tf.getHeaderElement(0), - indicator = dom.tag(th, 'img'); - deepEqual(tf.sort, false, 'Sort is removed'); - deepEqual(indicator.length, 0, 'Sort indicator is removed'); - }); - - } - - function startPaging(tf){ - var sort = tf.ExtRegistry.sort; - - module('Sanity checks'); - test('Sort extension', function() { - notEqual(sort, null, 'Sort instanciated'); - deepEqual(sort.stt instanceof SortableTable, true, 'Sort type'); - deepEqual(sort.sorted, false, 'Table not sorted'); - }); - - module('UI elements'); - test('Sort UI elements', function() { - var th = tf.getHeaderElement(0), - indicator = dom.tag(th, 'img'); - - deepEqual(indicator.length, 1, 'Sort indicator in header element'); - }); - - test('Sort behaviour', function() { - var th = tf.getHeaderElement(0); - sort.sortByColumnIndex(0); - - deepEqual(sort.sorted, true, 'Table column sorted'); - deepEqual(tf.paging, true, 'Table is paged'); - }); - - module('Destroy and re-init'); - test('Remove sort', function() { - sort.destroy(); - var th = tf.getHeaderElement(0), - indicator = dom.tag(th, 'img'); - deepEqual(tf.sort, false, 'Sort is removed'); - deepEqual(indicator.length, 0, 'Sort indicator is removed'); - }); - - } +var tag = function (elm, tag){ return elm.getElementsByTagName(tag); }; +var tf = new TableFilter('demo', { + base_path: '../dist/tablefilter/', + sort: true, + sort_config: { + sort_types: ['string','string','number','number','number'] + }, + grid_layout: true, + on_sort_loaded: startSimple }); +tf.init(); + +var tf1 = new TableFilter('demo2', { + base_path: '../dist/tablefilter/', + paging: true, + sort: true, + sort_config: { + sort_types: ['string','string','number','number','number'] + }, + grid_layout: true, + on_sort_loaded: startPaging +}); +tf1.init(); + +function startSimple(tf, sort){ + module('Sanity checks'); + test('Sort extension', function() { + notEqual(sort, null, 'Sort instanciated'); + deepEqual(sort.stt instanceof SortableTable, true, 'Sort type'); + deepEqual(sort.sorted, false, 'Table not sorted'); + }); + + test('Sort behaviour', function() { + var th = tf.getHeaderElement(0); + sort.sortByColumnIndex(0); + + deepEqual(sort.sorted, true, 'Table column sorted'); + deepEqual(sort.isPaged, false, 'Table is not paged'); + }); + + module('Destroy and re-init'); + test('Remove sort', function() { + sort.destroy(); + var th = tf.getHeaderElement(0), + indicator = tag(th, 'img'); + deepEqual(tf.sort, false, 'Sort is removed'); + deepEqual(indicator.length, 0, 'Sort indicator is removed'); + }); + +} + +function startPaging(tf, sort){ + // var sort = tf.ExtRegistry.sort; + + module('Sanity checks'); + test('Sort extension', function() { + notEqual(sort, null, 'Sort instanciated'); + deepEqual(sort.stt instanceof SortableTable, true, 'Sort type'); + deepEqual(sort.sorted, false, 'Table not sorted'); + }); + + module('UI elements'); + test('Sort UI elements', function() { + var th = tf.getHeaderElement(0), + indicator = tag(th, 'img'); + + deepEqual(indicator.length, 1, 'Sort indicator in header element'); + }); + + test('Sort behaviour', function() { + var th = tf.getHeaderElement(0); + sort.sortByColumnIndex(0); + + deepEqual(sort.sorted, true, 'Table column sorted'); + deepEqual(tf.paging, true, 'Table is paged'); + }); + + module('Destroy and re-init'); + test('Remove sort', function() { + sort.destroy(); + var th = tf.getHeaderElement(0), + indicator = tag(th, 'img'); + deepEqual(tf.sort, false, 'Sort is removed'); + deepEqual(indicator.length, 0, 'Sort indicator is removed'); + }); + +} diff --git a/test/test-sort-key.html b/test/test-sort-key.html index 9f4355e0..46f4a0f0 100644 --- a/test/test-sort-key.html +++ b/test/test-sort-key.html @@ -4,13 +4,7 @@ TableFilter sort by key - - @@ -240,7 +234,8 @@
- + +
diff --git a/test/test-sort-key.js b/test/test-sort-key.js index 974c5da5..ca804b88 100644 --- a/test/test-sort-key.js +++ b/test/test-sort-key.js @@ -1,74 +1,67 @@ -requirejs(['test-config', '../src/tablefilter'], function(config, TableFilter){ - var types = require('types').Types, - dom = require('dom').Dom; - - var tf = new TableFilter('demo', { - base_path: '../src/', - sort: true, - sort_config: { - sort_types:[ - 'String', - 'Number', - 'String', - 'String', - 'EU', - 'US', - 'String', - 'dmydate', - 'mdydate' - ] - }, - on_sort_loaded: start - }); - tf.init(); - - QUnit.start(); - - function start(tf){ - var sort = tf.ExtRegistry.sort; - - module('Sanity checks'); - test('Sort extension', function() { - notEqual(sort, null, 'Sort instanciated'); - deepEqual(sort.stt instanceof SortableTable, true, 'Sort type'); - deepEqual(sort.sorted, false, 'Table not sorted'); - }); - - module('UI elements'); - test('Sort UI elements', function() { - var th = tf.getHeaderElement(0), - indicator = dom.tag(th, 'img'), - validRows = tf.getValidRowsIndex(true); - - deepEqual(indicator.length, 1, 'Sort indicator in header element'); - deepEqual( - dom.getText(tf.tbl.rows[validRows[0]].cells[1]), - 'AUY78', - 'First custom key cell text before sorting'); - }); - - test('Sort behaviour', function() { - var th = tf.getHeaderElement(1), - validRows = tf.getValidRowsIndex(); - sort.sortByColumnIndex(1); - - deepEqual(sort.sorted, true, 'Table column sorted'); - deepEqual( - dom.getText(tf.tbl.rows[validRows[0]].cells[1]), - 'QT1', - 'First custom key cell text after sorting'); - }); - - module('Destroy and re-init'); - test('Remove sort', function() { - sort.destroy(); - var th = tf.getHeaderElement(0), - indicator = dom.tag(th, 'img'); - deepEqual(tf.sort, false, 'Sort is removed'); - deepEqual(indicator.length, 0, 'Sort indicator is removed'); - }); - - } +var tag = function (elm, tag){ return elm.getElementsByTagName(tag); }; +var tf = new TableFilter('demo', { + base_path: '../dist/tablefilter/', + sort: true, + sort_config: { + sort_types:[ + 'String', + 'Number', + 'String', + 'String', + 'EU', + 'US', + 'String', + 'dmydate', + 'mdydate' + ] + }, + on_sort_loaded: start }); +tf.init(); + +function start(tf, sort){ + + module('Sanity checks'); + test('Sort extension', function() { + notEqual(sort, null, 'Sort instanciated'); + deepEqual(sort.stt instanceof SortableTable, true, 'Sort type'); + deepEqual(sort.sorted, false, 'Table not sorted'); + }); + + module('UI elements'); + test('Sort UI elements', function() { + var th = tf.getHeaderElement(0), + indicator = tag(th, 'img'), + validRows = tf.getValidRowsIndex(true); + + deepEqual(indicator.length, 1, 'Sort indicator in header element'); + deepEqual( + (tf.tbl.rows[validRows[0]].cells[1]).innerHTML, + 'AUY78', + 'First custom key cell text before sorting'); + }); + + test('Sort behaviour', function() { + var th = tf.getHeaderElement(1), + validRows = tf.getValidRowsIndex(); + sort.sortByColumnIndex(1); + + deepEqual(sort.sorted, true, 'Table column sorted'); + deepEqual( + (tf.tbl.rows[validRows[0]].cells[1]).innerHTML, + 'QT1', + 'First custom key cell text after sorting'); + }); + + module('Destroy and re-init'); + test('Remove sort', function() { + sort.destroy(); + var th = tf.getHeaderElement(0), + indicator = tag(th, 'img'); + deepEqual(tf.sort, false, 'Sort is removed'); + deepEqual(indicator.length, 0, 'Sort indicator is removed'); + }); + +} diff --git a/test/test-sort.html b/test/test-sort.html index ab474ed3..8db00a38 100644 --- a/test/test-sort.html +++ b/test/test-sort.html @@ -4,13 +4,7 @@ TableFilter column sort - - @@ -139,7 +133,8 @@
- + +
diff --git a/test/test-sort.js b/test/test-sort.js index 9e1134fc..db8c92bf 100644 --- a/test/test-sort.js +++ b/test/test-sort.js @@ -1,103 +1,97 @@ -requirejs(['test-config', '../src/tablefilter'], function(config, TableFilter){ - var types = require('types').Types, - dom = require('dom').Dom; - - var tf = new TableFilter('demo', { - base_path: '../src/', - sort: true, - sort_config: { - sort_types: ['string','string','number','number','number'] - }, - on_sort_loaded: startSimple - }); - tf.init(); - - var tf1 = new TableFilter('demo2', { - base_path: '../src/', - paging: true, - sort: true, - sort_config: { - sort_types: ['string','string','number','number','number'] - }, - on_sort_loaded: startPaging - }); - tf1.init(); - - QUnit.start(); - - function startSimple(tf){ - var sort = tf.ExtRegistry.sort; - - module('Sanity checks'); - test('Sort extension', function() { - notEqual(sort, null, 'Sort instanciated'); - deepEqual(sort.stt instanceof SortableTable, true, 'Sort type'); - deepEqual(sort.sorted, false, 'Table not sorted'); - }); - - module('UI elements'); - test('Sort UI elements', function() { - var th = tf.getHeaderElement(0), - indicator = dom.tag(th, 'img'); - - deepEqual(indicator.length, 1, 'Sort indicator in header element'); - }); - - test('Sort behaviour', function() { - var th = tf.getHeaderElement(0); - sort.sortByColumnIndex(0); - - deepEqual(sort.sorted, true, 'Table column sorted'); - deepEqual(sort.isPaged, false, 'Table is not paged'); - }); - - module('Destroy and re-init'); - test('Remove sort', function() { - sort.destroy(); - var th = tf.getHeaderElement(0), - indicator = dom.tag(th, 'img'); - deepEqual(tf.sort, false, 'Sort is removed'); - deepEqual(indicator.length, 0, 'Sort indicator is removed'); - }); - - } - - function startPaging(tf){ - var sort = tf.ExtRegistry.sort; - - module('Sanity checks'); - test('Sort extension', function() { - notEqual(sort, null, 'Sort instanciated'); - deepEqual(sort.stt instanceof SortableTable, true, 'Sort type'); - deepEqual(sort.sorted, false, 'Table not sorted'); - }); - - module('UI elements'); - test('Sort UI elements', function() { - var th = tf.getHeaderElement(0), - indicator = dom.tag(th, 'img'); - - deepEqual(indicator.length, 1, 'Sort indicator in header element'); - }); - - test('Sort behaviour', function() { - var th = tf.getHeaderElement(0); - sort.sortByColumnIndex(0); - - deepEqual(sort.sorted, true, 'Table column sorted'); - deepEqual(tf.paging, true, 'Table is paged'); - }); - - module('Destroy and re-init'); - test('Remove sort', function() { - sort.destroy(); - var th = tf.getHeaderElement(0), - indicator = dom.tag(th, 'img'); - deepEqual(tf.sort, false, 'Sort is removed'); - deepEqual(indicator.length, 0, 'Sort indicator is removed'); - }); - - } +var tag = function (elm, tag){ return elm.getElementsByTagName(tag); }; +var tf = new TableFilter('demo', { + base_path: '../dist/tablefilter/', + sort: true, + sort_config: { + sort_types: ['string','string','number','number','number'] + }, + on_sort_loaded: startSimple }); +tf.init(); + +var tf1 = new TableFilter('demo2', { + base_path: '../dist/tablefilter/', + paging: true, + sort: true, + sort_config: { + sort_types: ['string','string','number','number','number'] + }, + on_sort_loaded: startPaging +}); +tf1.init(); + +function startSimple(tf, sort){ + // var sort = tf.ExtRegistry.sort; + + module('Sanity checks'); + test('Sort extension', function() { + notEqual(sort, null, 'Sort instanciated'); + deepEqual(sort.stt instanceof SortableTable, true, 'Sort type'); + deepEqual(sort.sorted, false, 'Table not sorted'); + }); + + module('UI elements'); + test('Sort UI elements', function() { + var th = tf.getHeaderElement(0), + indicator = tag(th, 'img'); + + deepEqual(indicator.length, 1, 'Sort indicator in header element'); + }); + + test('Sort behaviour', function() { + var th = tf.getHeaderElement(0); + sort.sortByColumnIndex(0); + + deepEqual(sort.sorted, true, 'Table column sorted'); + deepEqual(sort.isPaged, false, 'Table is not paged'); + }); + + module('Destroy and re-init'); + test('Remove sort', function() { + sort.destroy(); + var th = tf.getHeaderElement(0), + indicator = tag(th, 'img'); + deepEqual(tf.sort, false, 'Sort is removed'); + deepEqual(indicator.length, 0, 'Sort indicator is removed'); + }); + +} + +function startPaging(tf, sort){ + // var sort = tf.ExtRegistry.sort; + + module('Sanity checks'); + test('Sort extension', function() { + notEqual(sort, null, 'Sort instanciated'); + deepEqual(sort.stt instanceof SortableTable, true, 'Sort type'); + deepEqual(sort.sorted, false, 'Table not sorted'); + }); + + module('UI elements'); + test('Sort UI elements', function() { + var th = tf.getHeaderElement(0), + indicator = tag(th, 'img'); + + deepEqual(indicator.length, 1, 'Sort indicator in header element'); + }); + + test('Sort behaviour', function() { + var th = tf.getHeaderElement(0); + sort.sortByColumnIndex(0); + + deepEqual(sort.sorted, true, 'Table column sorted'); + deepEqual(tf.paging, true, 'Table is paged'); + }); + + module('Destroy and re-init'); + test('Remove sort', function() { + sort.destroy(); + var th = tf.getHeaderElement(0), + indicator = tag(th, 'img'); + deepEqual(tf.sort, false, 'Sort is removed'); + deepEqual(indicator.length, 0, 'Sort indicator is removed'); + }); + +} diff --git a/test/test-status-bar.js b/test/test-status-bar.js index ef22ff4a..43ea896a 100644 --- a/test/test-status-bar.js +++ b/test/test-status-bar.js @@ -1,47 +1,42 @@ -requirejs(['test-config', '../src/tablefilter'], function(config, TableFilter){ - QUnit.start(); - - var StatusBar = require('modules/statusBar').StatusBar, - types = require('types').Types, - dom = require('dom').Dom; - - var tf = new TableFilter('demo', { - status_bar: true - }); - tf.init(); - - var statusBar = tf.Cpt.statusBar; - module('Sanity checks'); - test('Status bar component', function() { - deepEqual(statusBar instanceof StatusBar, true, 'StatusBar type'); - notEqual(statusBar.statusBarDiv, null, 'statusBarDiv property'); - }); - - module('UI elements'); - test('Status bar UI elements', function() { - var container = statusBar.statusBarDiv, - label = statusBar.statusBarSpanText; - deepEqual(container.nodeName, 'DIV', 'Status bar container'); - deepEqual(label.nodeName, 'SPAN', 'Status bar label'); - }); - - module('Destroy'); - test('Remove UI', function() { - statusBar.destroy(); - var container = statusBar.statusBarDiv, - label = statusBar.statusBarSpanText; - deepEqual(container, null, 'Status bar container removed'); - deepEqual(label, null, 'Status bar button removed'); - }); - - test('Re-set UI', function() { - statusBar.statusBarText = '→←'; - statusBar.init(); - - var label = statusBar.statusBarSpanText; - notEqual( - dom.getText(label).indexOf('→←'), -1, 'Status bar text'); - }); +var StatusBar = TableFilter.StatusBar; +var tf = new TableFilter('demo', { + base_path: '../dist/tablefilter/', + status_bar: true }); +tf.init(); + +var statusBar = tf.Cpt.statusBar; +module('Sanity checks'); +test('Status bar component', function() { + deepEqual(statusBar instanceof StatusBar, true, 'StatusBar type'); + notEqual(statusBar.statusBarDiv, null, 'statusBarDiv property'); +}); + +module('UI elements'); +test('Status bar UI elements', function() { + var container = statusBar.statusBarDiv, + label = statusBar.statusBarSpanText; + deepEqual(container.nodeName, 'DIV', 'Status bar container'); + deepEqual(label.nodeName, 'SPAN', 'Status bar label'); +}); + +module('Destroy'); +test('Remove UI', function() { + statusBar.destroy(); + var container = statusBar.statusBarDiv, + label = statusBar.statusBarSpanText; + deepEqual(container, null, 'Status bar container removed'); + deepEqual(label, null, 'Status bar button removed'); +}); + +test('Re-set UI', function() { + statusBar.statusBarText = '→←'; + statusBar.init(); + + var label = statusBar.statusBarSpanText; + notEqual( + label.innerHTML.indexOf('→←'), -1, 'Status bar text'); +}); + diff --git a/test/test-store.js b/test/test-store.js index 104a094e..c90130c8 100644 --- a/test/test-store.js +++ b/test/test-store.js @@ -1,65 +1,62 @@ -requirejs(['test-config', '../src/tablefilter'], function(config, TableFilter){ - QUnit.start(); - - var Store = require('modules/store').Store; - var Cookie = require('cookie').Cookie; - - var tf = new TableFilter('demo', { - paging: true, - paging_length: 2, - results_per_page: ['Results per page', [2,4,6]], - remember_grid_values: true, - remember_page_number: true, - remember_page_length: true - }); - - Cookie.remove(tf.fltsValuesCookie); - Cookie.remove(tf.pgNbCookie); - Cookie.remove(tf.pgLenCookie); - - tf.init(); - tf._clearFilters(); - - module('Sanity checks'); - test('Store module', function() { - deepEqual(tf.Cpt.store instanceof Store, true, 'Store type'); - notEqual(tf.Cpt.store, null, 'Store instanciated'); - deepEqual(tf.Cpt.store.duration, 100000, 'Store duration'); - }); - - module('Check page number persistence'); - test('Page number value', function() { - tf._clearFilters(); - tf._filter(); - tf.Cpt.paging._changePage(1); - var cookieName = tf.pgNbCookie; - deepEqual(tf.Cpt.store.getPageNb(cookieName), '2', 'Page number value'); - tf._clearFilters(); - tf._filter(); - }); - - module('Check page length persistence'); - test('Page length value', function() { - var paging = tf.Cpt.paging; - paging.resultsPerPageSlc.options[2].selected = true; - paging._changeResultsPerPage(); - var cookieName = tf.pgLenCookie; - deepEqual(tf.Cpt.store.getPageLength(cookieName), '2', 'Page length value'); - tf._clearFilters(); - tf._filter(); - }); - - module('Check filters persistence'); - test('Filters value', function() { - tf.setFilterValue(0, 'Sydney'); - tf.setFilterValue(3, '1.5'); - tf._filter(); - var cookieName = tf.fltsValuesCookie; - deepEqual(tf.Cpt.store.getFilterValues(cookieName)[0], 'Sydney', 'Filter 0 value'); - deepEqual(tf.Cpt.store.getFilterValues(cookieName)[3], '1.5', 'Filter 3 value'); - tf._clearFilters(); - tf._filter(); - }); +var Store = TableFilter.Store; +var Cookie = TableFilter.Cookie; +var tf = new TableFilter('demo', { + base_path: '../dist/tablefilter/', + paging: true, + paging_length: 2, + results_per_page: ['Results per page', [2,4,6]], + remember_grid_values: true, + remember_page_number: true, + remember_page_length: true }); + +Cookie.remove(tf.fltsValuesCookie); +Cookie.remove(tf.pgNbCookie); +Cookie.remove(tf.pgLenCookie); + +tf.init(); +tf._clearFilters(); + +module('Sanity checks'); +test('Store module', function() { + deepEqual(tf.Cpt.store instanceof Store, true, 'Store type'); + notEqual(tf.Cpt.store, null, 'Store instanciated'); + deepEqual(tf.Cpt.store.duration, 100000, 'Store duration'); +}); + +module('Check page number persistence'); +test('Page number value', function() { + tf._clearFilters(); + tf._filter(); + tf.Cpt.paging._changePage(1); + var cookieName = tf.pgNbCookie; + deepEqual(tf.Cpt.store.getPageNb(cookieName), '2', 'Page number value'); + tf._clearFilters(); + tf._filter(); +}); + +module('Check page length persistence'); +test('Page length value', function() { + var paging = tf.Cpt.paging; + paging.resultsPerPageSlc.options[2].selected = true; + paging._changeResultsPerPage(); + var cookieName = tf.pgLenCookie; + deepEqual(tf.Cpt.store.getPageLength(cookieName), '2', 'Page length value'); + tf._clearFilters(); + tf._filter(); +}); + +module('Check filters persistence'); +test('Filters value', function() { + tf.setFilterValue(0, 'Sydney'); + tf.setFilterValue(3, '1.5'); + tf._filter(); + var cookieName = tf.fltsValuesCookie; + deepEqual(tf.Cpt.store.getFilterValues(cookieName)[0], 'Sydney', 'Filter 0 value'); + deepEqual(tf.Cpt.store.getFilterValues(cookieName)[3], '1.5', 'Filter 3 value'); + tf._clearFilters(); + tf._filter(); +}); + diff --git a/test/test.js b/test/test.js index cc01080f..27c88045 100644 --- a/test/test.js +++ b/test/test.js @@ -1,6 +1,8 @@ (function(win, TableFilter) { - var tf = new TableFilter('demo'); + var tf = new TableFilter('demo', { + base_path: '../dist/tablefilter/' + }); tf.init(); module("Sanity checks");