From dc4df9e14ccf70b84e8eabd0f1f8560c0ddc0704 Mon Sep 17 00:00:00 2001 From: Max Guglielmi Date: Sat, 28 Feb 2015 20:27:28 +1100 Subject: [PATCH] Switched to Babel --- .jshintrc | 2 + Gruntfile.js | 16 +- dist/filtergrid.css | 2 +- dist/tablefilter.js | 10 +- package.json | 2 +- src-es6/core.js | 117 +- src/array.js | 50 +- src/cookie.js | 105 +- src/core.js | 3053 +----------------------------- src/date.js | 318 ++-- src/dom.js | 296 +-- src/event.js | 93 +- src/helpers.js | 23 +- src/index.html | 2 +- src/modules/alternateRows.js | 221 ++- src/modules/checkList.js | 777 ++++---- src/modules/clearButton.js | 193 +- src/modules/colOps.js | 547 +++--- src/modules/dropdown.js | 593 +++--- src/modules/gridLayout.js | 658 +++---- src/modules/help.js | 297 +-- src/modules/highlightKeywords.js | 230 ++- src/modules/loader.js | 178 +- src/modules/paging.js | 1417 +++++++------- src/modules/popupFilter.js | 452 +++-- src/modules/rowsCounter.js | 274 +-- src/modules/statusBar.js | 248 +-- src/modules/store.js | 196 +- src/sort.js | 12 +- src/string.js | 79 +- src/types.js | 101 +- test/test-grid-layout.js | 3 +- 32 files changed, 4107 insertions(+), 6458 deletions(-) diff --git a/.jshintrc b/.jshintrc index b5e5b6ac..1049cdec 100644 --- a/.jshintrc +++ b/.jshintrc @@ -6,6 +6,8 @@ // Eval can be harmful "-W061": true, "-W041": true, + // Wrap the /regexp/ literal in parens to disambiguate the slash operator + "-W092": true, "curly": true, //"indent": 4, //"eqeqeq": true, diff --git a/Gruntfile.js b/Gruntfile.js index c5dafbd2..ed59955f 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -39,9 +39,9 @@ module.exports = function (grunt) { compile: { options: { baseUrl: '<%= source_folder %>', - 'paths': { - 'tf': '.' - }, + // 'paths': { + // 'tf': '.' + // }, include: ['../libs/almond/almond', 'core'], out: '<%= dist_folder %>tablefilter.js', wrap: { @@ -118,7 +118,7 @@ module.exports = function (grunt) { } }, - '6to5': { + 'babel': { options: { sourceMap: true, modules: 'amd' @@ -143,12 +143,12 @@ module.exports = function (grunt) { grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-qunit'); grunt.loadNpmTasks('grunt-contrib-requirejs'); - grunt.loadNpmTasks('grunt-6to5'); + grunt.loadNpmTasks('grunt-babel'); // This is the default task being executed if Grunt // is called without any further parameter. - grunt.registerTask('default', ['jshint', '6to5', 'requirejs', 'concat', 'uglify', 'cssmin', 'copy', 'qunit']); - grunt.registerTask('dev', ['jshint', '6to5', 'concat', 'cssmin', 'copy']); - grunt.registerTask('toes5', ['6to5']); + grunt.registerTask('default', ['jshint', 'babel', 'requirejs', 'concat', 'uglify', 'cssmin', 'copy', 'qunit']); + grunt.registerTask('dev', ['jshint', 'babel', 'concat', 'cssmin', 'copy']); + grunt.registerTask('toes5', ['babel']); grunt.registerTask('test', ['qunit']); }; diff --git a/dist/filtergrid.css b/dist/filtergrid.css index 842cc180..8fcad87f 100644 --- a/dist/filtergrid.css +++ b/dist/filtergrid.css @@ -1,6 +1,6 @@ /*------------------------------------------------------------------------ - TableFilter stylesheet by Max Guglielmi - - (build date: Sun Feb 22 2015 22:45:26) + - (build date: Sat Feb 28 2015 20:15:53) - Edit below for your projects' needs ------------------------------------------------------------------------*/ diff --git a/dist/tablefilter.js b/dist/tablefilter.js index 3e0e5894..0109c7a5 100644 --- a/dist/tablefilter.js +++ b/dist/tablefilter.js @@ -1,10 +1,10 @@ /*------------------------------------------------------------------------ - TableFilter v3.0.0 by Max Guglielmi - - build date: Sat Feb 21 2015 12:20:52 + - build date: Sat Feb 28 2015 20:15:47 - http://tablefilter.free.fr - Copyright (c) 2014, Licensed under the MIT License ------------------------------------------------------------------------*/ -!function(a,b){"function"==typeof define&&define.amd?define(b):"object"==typeof exports?module.exports=b:a.TableFilter=b()}(this,function(){var requirejs,require,define;return function(a){function b(a,b){return r.call(a,b)}function c(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=p.map,q=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(n=n.slice(0,n.length-1),a=a.split("/"),g=a.length-1,p.nodeIdCompat&&t.test(a[g])&&(a[g]=a[g].replace(t,"")),a=n.concat(a),k=0;k0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||q)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&q&&q[d]&&(i=q[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function d(b,c){return function(){var d=s.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),k.apply(a,d.concat([b,c]))}}function e(a){return function(b){return c(b,a)}}function f(a){return function(b){n[a]=b}}function g(c){if(b(o,c)){var d=o[c];delete o[c],q[c]=!0,j.apply(a,d)}if(!b(n,c)&&!b(q,c))throw new Error("No "+c);return n[c]}function h(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function i(a){return function(){return p&&p.config&&p.config[a]||{}}}var j,k,l,m,n={},o={},p={},q={},r=Object.prototype.hasOwnProperty,s=[].slice,t=/\.js$/;l=function(a,b){var d,f=h(a),i=f[0];return a=f[1],i&&(i=c(i,b),d=g(i)),i?a=d&&d.normalize?d.normalize(a,e(b)):c(a,b):(a=c(a,b),f=h(a),i=f[0],a=f[1],i&&(d=g(i))),{f:i?i+"!"+a:a,n:a,pr:i,p:d}},m={require:function(a){return d(a)},exports:function(a){var b=n[a];return"undefined"!=typeof b?b:n[a]={}},module:function(a){return{id:a,uri:"",exports:n[a],config:i(a)}}},j=function(c,e,h,i){var j,k,p,r,s,t,u=[],v=typeof h;if(i=i||c,"undefined"===v||"function"===v){for(e=!e.length&&h.length?["require","exports","module"]:e,s=0;s]+>/g,"");return b=b.replace(/^\s+/,"").replace(/\s+$/,"")},c.create=function(a){if(a&&""!==a){var b=document.createElement(a),c=arguments;if(c.length>1)for(var d=0;d0){var d=document.cookie,e=d.indexOf(c);if(-1!==e){e+=c.length;var f=d.indexOf(";",e);-1===f&&(f=d.length),b=unescape(d.substring(e,f))}}return b},b.remove=function(a){this.write(a,"",-1)},b.valueToArray=function(a,b){b||(b=",");var c=this.read(a),d=c.split(b);return d},b.getValueByIndex=function(a,b,c){c||(c=",");var d=this.valueToArray(a,c);return d[b]},a.Cookie=b}),define("types",["exports"],function(a){var b={},c=void 0;b.isObj=function(a){var b=!1;return"string"==typeof a?window[a]&&"object"==typeof window[a]&&(b=!0):a&&"object"==typeof a&&(b=!0),b},b.isFn=function(a){return a&&a.constructor==Function},b.isArray=function(a){return a&&a.constructor==Array},b.isUndef=function(a){return a===c},a.Types=b}),define("array",["exports","string"],function(a,b){var c=b.Str,d={has:function(a,b,d){for(var e=void 0===d?!1:d,f=0;f2)return a;var b;return 99>=a&&a>50&&(b="19"+a),(50>a||"00"===a)&&(b="20"+a),b}function d(a){if(void 0===a)return 0;for(var b,c=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],d=0;d11||23>b)&&(b-=12),1>b||b>12?0:b}if(b||(b="DMY"),!a||""===a)return new Date(1001,0,1);var e,f;switch(b.toUpperCase()){case"DDMMMYYYY":f=a.replace(/[- \/.]/g," ").split(" "),e=new Date(c(f[2]),d(f[1])-1,f[0]);break;case"DMY":f=a.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),e=new Date(c(f[2]),f[1]-1,f[0]);break;case"MDY":f=a.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),e=new Date(c(f[2]),f[0]-1,f[1]);break;case"YMD":f=a.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),e=new Date(c(f[0]),f[1]-1,f[2]);break;default:f=a.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),e=new Date(c(f[2]),f[1]-1,f[0])}return e}};a.DateHelper=b}),define("sort",["exports","string"],function(a,b){var c=b.Str,d={ignoreCase:function(a,b){var d=c.lower(a),e=c.lower(b);return e>d?-1:d>e?1:0}};a.Sort=d}),define("modules/store",["exports","../cookie"],function(a,b){var c=function(a,b,c){b&&Object.defineProperties(a,b),c&&Object.defineProperties(a.prototype,c)},d=b.Cookie,e=function(){var a=function(a){var b=a.fObj;this.duration=isNaN(b.set_cookie_duration)?1e5:parseInt(b.set_cookie_duration,10),this.tf=a};return c(a,null,{saveFilterValues:{writable:!0,value:function(a){for(var b=this.tf,c=[],e=0;e0&&c.removeChild(y[0]),this.headTbl.style.width=c.style.width,this.headTbl.style.tableLayout="fixed",c.style.tableLayout="fixed",this.headTbl.cellPadding=c.cellPadding,this.headTbl.cellSpacing=c.cellSpacing,a.SetColWidths(),this.headTblCont.style.width=this.tblCont.clientWidth+"px",c.style.width="";var z=this;i.add(this.tblCont,"scroll",function(){var a=this.scrollLeft;if(z.headTblCont.scrollLeft=a,!z.isPointerXOverwritten)try{z.Evt.pointerX=function(b){var c=b||global.event,d=tf_StandardBody().scrollLeft+a;return c.pageX+a||c.clientX+d},z.isPointerXOverwritten=!0}catch(b){z.isPointerXOverwritten=!1}}),b.sort!==!1&&(a.sort=!0,a.sortConfig.asyncSort=!0,a.sortConfig.triggerIds=o),this.gridEnableColResizer&&(a.hasExtensions?a.__containsStr("colsresizer",Str.lower(a.extensions.src.toString()))||(a.extensions.name.push("ColumnsResizer_"+a.id),a.extensions.src.push(a.gridColResizerPath),a.extensions.description.push("Columns Resizing"),a.extensions.initialize.push(function(a){a.SetColsResizer("ColumnsResizer_"+a.id)})):(a.extensions={name:["ColumnsResizer_"+a.id],src:[this.gridColResizerPath],description:["Columns Resizing"],initialize:[function(a){a.SetColsResizer("ColumnsResizer_"+a.id)}]},a.hasExtensions=!0)),b.col_resizer_cols_headers_table=this.headTbl.getAttribute("id"),b.col_resizer_cols_headers_index=this.gridHeadRowIndex,b.col_resizer_width_adjustment=0,b.col_enable_text_ellipsis=!1,z.tblHasColTag=g.tag(c,"col").length>0?!0:!1;var A=function(b){if(b){for(var d=a.nbCells-1;d>=0;d--){var e=g.create("col",["id",a.id+"_col_"+d]);c.firstChild.parentNode.insertBefore(e,c.firstChild),e.style.width=a.colWidth[d],b.gridColElms[d]=e}b.tblHasColTag=!0}};if(z.tblHasColTag)for(var B=g.tag(c,"col"),C=0;C',this.popUpDivCssClass=b.popup_div_css_class||"popUpFilter",this.onBeforePopUpOpen=g.isFn(b.on_before_popup_filter_open)?b.on_before_popup_filter_open:null,this.onAfterPopUpOpen=g.isFn(b.on_after_popup_filter_open)?b.on_after_popup_filter_open:null,this.onBeforePopUpClose=g.isFn(b.on_before_popup_filter_close)?b.on_before_popup_filter_close:null,this.onAfterPopUpClose=g.isFn(b.on_after_popup_filter_close)?b.on_after_popup_filter_close:null,this.popUpFltSpans=[],this.popUpFltImgs=[],this.popUpFltElms=this.popUpFltElmCache||[],this.popUpFltAdjustToContainer=!0,this.tf=a};return f(a,null,{onClick:{writable:!0,value:function(a){var b=a||global.event,c=b.target.parentNode,d=parseInt(c.getAttribute("ci"),10);if(this.closeAll(d),this.toggle(d),this.popUpFltAdjustToContainer){var e=this.popUpFltElms[d],f=this.tf.GetHeaderElement(d),g=.95*f.clientWidth;if(j.isIE()){var k=h.position(f).left;e.style.left=k+"px"}e.style.width=parseInt(g,10)+"px"}i.cancel(b),i.stop(b)}},init:{writable:!0,value:function(){for(var a=this,b=this.tf,c=0;cv;v++)if(a===v&&(!b||b&&e.disableExcludedOptions)||a==v&&b&&(""===l[s].style.display&&!e.paging||e.paging&&(!e.validRowsIndex||e.validRowsIndex&&h.has(e.validRowsIndex,s))&&(void 0===n||n==a||n!=a&&h.has(e.validRowsIndex,s)))){var w=e.GetCellData(v,t[v]),x=i.matchCase(w,m);if(h.has(this.opts,x,m)||this.opts.push(w),b&&e.disableExcludedOptions){var y=r[v];y||(y=this.GetFilteredDataCol(v)),!h.has(y,x,m)&&!h.has(q,x,m)&&!this.isFirstLoad&&q.push(w)}}}if(this.isCustom){var z=e.__getCustomValues(a);this.opts=z[0],this.optsTxt=z[1]}if(e.sortSlc&&!this.isCustom&&(m?(this.opts.sort(),q&&q.sort()):(this.opts.sort(j.ignoreCase),q&&q.sort(j.ignoreCase))),e.sortNumAsc&&h.has(e.sortNumAsc,a))try{this.opts.sort(numSortAsc),q&&q.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(A){this.opts.sort(),q&&q.sort(),this.isCustom&&this.optsTxt.sort()}if(e.sortNumDesc&&h.has(e.sortNumDesc,a))try{this.opts.sort(numSortDesc),q&&q.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(A){this.opts.sort(),q&&q.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(a,k,b,q,o,p)}}},addOptions:{writable:!0,value:function(a,b,c,d,e,f){var j=this.tf,k=i.lower(this.slcFillingMethod),l=b.value;b.innerHTML="",b=this.addFirstOption(b);for(var m=0;m"+o+""}else{var r;r=j.fillSlcOnDemand&&l===this.opts[m]&&j["col"+a]===j.fltTypeSlc?g.createOpt(o,n,!0):j["col"+a]!==j.fltTypeMulti?g.createOpt(o,n," "!==e[a]&&n===e[a]?!0:!1):g.createOpt(o,n,h.has(f,i.matchCase(this.opts[m],j.matchCase),j.matchCase)||-1!==f.toString().indexOf(n)?!0:!1),p&&(r.disabled=!0),b.appendChild(r)}}"innerhtml"===k&&(b.innerHTML+=this.slcInnerHtml),b.setAttribute("filled","1")}},addFirstOption:{writable:!0,value:function(a){var b=this.tf,c=i.lower(this.slcFillingMethod);if("innerhtml"===c)this.slcInnerHtml+='";else{var d=g.createOpt(this.enableSlcResetFilter?b.displayAllText:"","");if(this.enableSlcResetFilter||(d.style.display="none"),a.appendChild(d),b.enableEmptyOption){var e=g.createOpt(b.emptyText,b.emOperator);a.appendChild(e)}if(b.enableNonEmptyOption){var f=g.createOpt(b.nonEmptyText,b.nmOperator);a.appendChild(f)}}return a}}}),a}();a.Dropdown=k}),define("modules/checkList",["exports","../dom","../array","../string","../sort","../event"],function(a,b,c,d,e,f){var g=function(a,b,c){b&&Object.defineProperties(a,b),c&&Object.defineProperties(a.prototype,c)},h=b.Dom,i=c.Arr,j=d.Str,k=e.Sort,l=f.Event,m=function(){var a=function(a){var b=a.fObj;this.checkListDiv=[],this.checkListDivCssClass=b.div_checklist_css_class||"div_checklist",this.checkListCssClass=b.checklist_css_class||"flt_checklist",this.checkListItemCssClass=b.checklist_item_css_class||"flt_checklist_item",this.checkListSlcItemCssClass=b.checklist_selected_item_css_class||"flt_checklist_slc_item",this.activateCheckListTxt=b.activate_checklist_text||"Click to load filter data",this.checkListItemDisabledCssClass=b.checklist_item_disabled_css_class||"flt_checklist_item_disabled",this.enableCheckListResetFilter=b.enable_checklist_reset_filter===!1?!1:!0,this.isCustom=null,this.opts=null,this.optsTxt=null,this.tf=a};return g(a,null,{onChange:{writable:!0,value:function(a){this.tf.Evt._OnSlcChange(a)}},optionClick:{writable:!0,value:function(a){this.setCheckListValues(a.target),this.onChange(a)}},build:{writable:!0,value:function(a,b,c){var d=this.tf;d.EvtManager(d.Evt.name.checklist,{slcIndex:a,slcExternal:b,slcId:c})}},_build:{writable:!0,value:function(a,b,c){var d=this;void 0===c&&(c=null),void 0===b&&(b=!1);var e=this.tf;a=parseInt(a,10),this.opts=[],this.optsTxt=[];var f=e.prfxCheckListDiv+a+"_"+e.id;if((h.id(f)||b)&&(h.id(c)||!b)){var g=b?h.id(c):this.checkListDiv[a],m=h.create("ul",["id",e.fltIds[a]],["colIndex",a]);m.className=this.checkListCssClass,l.add(m,"change",function(a){d.onChange(a)});var n=e.tbl.rows;this.isCustom=e.hasCustomSlcOptions&&i.has(e.customSlcOptions.cols,a);var o;e.refreshFilters&&e.activeFilterId&&(o=e.activeFilterId.split("_")[0],o=o.split(e.prfxFlt)[1]);var p,q=[];e.refreshFilters&&e.disableExcludedOptions&&(p=[]);for(var r=e.refRow;ru;u++)if(a===u&&(!e.refreshFilters||e.refreshFilters&&e.disableExcludedOptions)||a===u&&e.refreshFilters&&(""===n[r].style.display&&!e.paging||e.paging&&(!o||o===a||o!=a&&i.has(e.validRowsIndex,r)))){var v=e.GetCellData(u,s[u]),w=j.matchCase(v,e.matchCase);i.has(this.opts,w,e.matchCase)||this.opts.push(v);var x=q[u];e.refreshFilters&&e.disableExcludedOptions&&(x||(q[u]=e.GetFilteredDataCol(u)),!i.has(x,w,e.matchCase)&&!i.has(p,w,e.matchCase)&&!e.isFirstLoad&&p.push(v))}}if(this.isCustom){var y=e.__getCustomValues(a);this.opts=y[0],this.optsTxt=y[1]}if(e.sortSlc&&!this.isCustom&&(e.matchCase?(this.opts.sort(),p&&p.sort()):(this.opts.sort(k.ignoreCase),p&&p.sort(k.ignoreCase))),e.sortNumAsc&&i.has(e.sortNumAsc,a))try{this.opts.sort(numSortAsc),p&&p.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(z){this.opts.sort(),p&&p.sort(),this.isCustom&&this.optsTxt.sort()}if(e.sortNumDesc&&i.has(e.sortNumDesc,a))try{this.opts.sort(numSortDesc),p&&p.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(z){this.opts.sort(),p&&p.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(a,m,e.separator),e.fillSlcOnDemand&&(g.innerHTML=""),g.appendChild(m),g.setAttribute("filled","1")}}},addChecks:{writable:!0,value:function(a,b){var c=this,d=this.tf,e=this.addTChecks(a,b),f=[],g=d.Cpt.store,k=g?g.getFilterValues(d.fltsValuesCookie)[a]:null;k&&j.trim(k).length>0&&(d.hasCustomSlcOptions&&i.has(d.customSlcOptions.cols,a)?f.push(k):f=k.split(" "+d.orOperator+" "));for(var m=0;m0?1:0),f=e+d.pagingLength-1<=b.nbVisibleRows?e+d.pagingLength-1:b.nbVisibleRows;c=e+this.fromToTextSeparator+f+this.overText+b.nbVisibleRows}}else c=a&&""!==a?a:b.nbFilterableRows-b.nbHiddenRows-(b.hasVisibleRows?b.visibleRows.length:0);this.rowsCounterSpan.innerHTML=c,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,b,this.rowsCounterSpan,c)}}},destroy:{writable:!0,value:function(){var a=this.tf;a.hasGrid&&this.rowsCounterSpan&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?h.isIE()?this.rowsCounterDiv.outerHTML="":this.rowsCounterDiv.parentNode.removeChild(this.rowsCounterDiv):f.id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null)}}}),a}();a.RowsCounter=i}),define("modules/statusBar",["exports","../dom","../event","../types","../helpers"],function(a,b,c,d,e){var f=function(a,b,c){b&&Object.defineProperties(a,b),c&&Object.defineProperties(a.prototype,c)},g=b.Dom,h=(c.Event,d.Types),i=e.Helpers,j=function(){var a=function(a){var b=a.fObj||{};this.statusBarTgtId=b.status_bar_target_id||null,this.statusBarDiv=null,this.statusBarSpan=null,this.statusBarSpanText=null,this.statusBarText=b.status_bar_text||"",this.statusBarCssClass=b.status_bar_css_class||"status",this.statusBarCloseDelay=250,this.onBeforeShowMsg=h.isFn(b.on_before_show_msg)?b.on_before_show_msg:null,this.onAfterShowMsg=h.isFn(b.on_after_show_msg)?b.on_after_show_msg:null,this.tf=a};return f(a,null,{init:{writable:!0,value:function(){var a=this.tf;if(a.hasGrid||a.isFirstLoad){var b=g.create("div",["id",a.prfxStatus+a.id]);b.className=this.statusBarCssClass;var c=g.create("span",["id",a.prfxStatusSpan+a.id]),d=g.create("span",["id",a.prfxStatusTxt+a.id]);d.appendChild(g.text(this.statusBarText)),this.statusBarTgtId||a.SetTopDiv();var e=this.statusBarTgtId?g.id(this.statusBarTgtId):a.lDiv;this.statusBarDiv&&i.isIE()&&(this.statusBarDiv.outerHTML=""),this.statusBarTgtId?(e.appendChild(d),e.appendChild(c)):(b.appendChild(d),b.appendChild(c),e.appendChild(b)),this.statusBarDiv=b,this.statusBarSpan=c,this.statusBarSpanText=d}}},message:{writable:!0,value:function(a){var b=this;void 0===a&&(a="");var c=this.tf;if(c.statusBar&&this.statusBarSpan){this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this.tf,a);var d=""===a?this.statusBarCloseDelay:1;window.setTimeout(function(){b.statusBarSpan.innerHTML=a,b.onAfterShowMsg&&b.onAfterShowMsg.call(null,b.tf,a)},d)}}},destroy:{writable:!0,value:function(){var a=this.tf;a.hasGrid&&this.statusBarDiv&&(this.statusBarDiv.innerHTML="",this.statusBarDiv.parentNode.removeChild(this.statusBarDiv),this.statusBarSpan=null,this.statusBarSpanText=null,this.statusBarDiv=null)}}}),a}();a.StatusBar=j}),define("modules/paging",["exports","../dom","../types","../string","../helpers","../event"],function(a,b,c,d,e,f){var g=function(a,b,c){b&&Object.defineProperties(a,b),c&&Object.defineProperties(a.prototype,c)},h=b.Dom,i=c.Types,j=d.Str,k=(e.Helpers,f.Event),l=function(){var a=function(a){var b=a.fObj;this.btnPageCssClass=b.paging_btn_css_class||"pgInp",this.pagingSlc=null,this.resultsPerPageSlc=null,this.pagingTgtId=b.paging_target_id||null,this.pagingLength=isNaN(b.paging_length)?10:b.paging_length,this.resultsPerPageTgtId=b.results_per_page_target_id||null,this.pgSlcCssClass=b.paging_slc_css_class||"pgSlc",this.pgInpCssClass=b.paging_inp_css_class||"pgNbInp",this.resultsPerPage=b.results_per_page||null,this.hasResultsPerPage=i.isArray(this.resultsPerPage),this.resultsSlcCssClass=b.results_slc_css_class||"rspg",this.resultsSpanCssClass=b.results_span_css_class||"rspgSpan",this.startPagingRow=0,this.nbPages=0,this.currentPageNb=1,this.btnNextPageText=b.btn_next_page_text||">",this.btnPrevPageText=b.btn_prev_page_text||"<",this.btnLastPageText=b.btn_last_page_text||">|",this.btnFirstPageText=b.btn_first_page_text||"|<",this.btnNextPageHtml=b.btn_next_page_html||(a.enableIcons?'':null),this.btnPrevPageHtml=b.btn_prev_page_html||(a.enableIcons?'':null),this.btnFirstPageHtml=b.btn_first_page_html||(a.enableIcons?'':null),this.btnLastPageHtml=b.btn_last_page_html||(a.enableIcons?'':null),this.pageText=b.page_text||" Page ",this.ofText=b.of_text||" of ",this.nbPgSpanCssClass=b.nb_pages_css_class||"nbpg",this.hasPagingBtns=b.paging_btns===!1?!1:!0,this.pageSelectorType=b.page_selector_type||a.fltTypeSlc,this.onBeforeChangePage=i.isFn(b.on_before_change_page)?b.on_before_change_page:null,this.onAfterChangePage=i.isFn(b.on_after_change_page)?b.on_after_change_page:null;var c=this.refRow,d=this.nbRows;this.nbPages=Math.ceil((d-c)/this.pagingLength);var e=this;this.evt={slcIndex:function(){return e.pageSelectorType===a.fltTypeSlc?e.pagingSlc.options.selectedIndex:parseInt(e.pagingSlc.value,10)-1},nbOpts:function(){return e.pageSelectorType===a.fltTypeSlc?parseInt(e.pagingSlc.options.length,10)-1:e.nbPages-1},next:function(){var a=e.evt.slcIndex()0?e.evt.slcIndex()-1:e.evt.nbOpts();e.changePage(a)},last:function(){e.changePage(e.evt.nbOpts())},first:function(){e.changePage(0)},_detectKey:function(b){var c=a.Evt.getKeyCode(b);13===c&&(a.sorted?(a.Filter(),e.changePage(e.evt.slcIndex())):e.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},this.tf=a};return g(a,null,{init:{writable:!0,value:function(){var a,b=this,c=this.tf,d=this.evt;this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),d.slcPagesChange=function(a){b.changePage(),a.target.blur()},this.pageSelectorType===c.fltTypeSlc&&(a=h.create(c.fltTypeSlc,["id",c.prfxSlcPages+c.id]),a.className=this.pgSlcCssClass,k.add(a,"change",d.slcPagesChange)),this.pageSelectorType===c.fltTypeInp&&(a=h.create(c.fltTypeInp,["id",c.prfxSlcPages+c.id],["value",this.currentPageNb]),a.className=this.pgInpCssClass,k.add(a,"keypress",d._detectKey));var e=h.create("span",["id",c.prfxBtnNextSpan+c.id]),f=h.create("span",["id",c.prfxBtnPrevSpan+c.id]),g=h.create("span",["id",c.prfxBtnLastSpan+c.id]),i=h.create("span",["id",c.prfxBtnFirstSpan+c.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)e.innerHTML=this.btnNextPageHtml,k.add(e,"click",d.next);else{var j=h.create(c.fltTypeInp,["id",c.prfxBtnNext+c.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);j.className=this.btnPageCssClass,k.add(j,"click",d.next),e.appendChild(j)}if(this.btnPrevPageHtml)f.innerHTML=this.btnPrevPageHtml,k.add(f,"click",d.prev);else{var l=h.create(c.fltTypeInp,["id",c.prfxBtnPrev+c.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);l.className=this.btnPageCssClass,k.add(l,"click",d.prev),f.appendChild(l)}if(this.btnLastPageHtml)g.innerHTML=this.btnLastPageHtml,k.add(g,"click",d.last);else{var m=h.create(c.fltTypeInp,["id",c.prfxBtnLast+c.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);m.className=this.btnPageCssClass,k.add(m,"click",d.last),g.appendChild(m)}if(this.btnFirstPageHtml)i.innerHTML=this.btnFirstPageHtml,k.add(i,"click",d.first);else{var n=h.create(c.fltTypeInp,["id",c.prfxBtnFirst+c.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);n.className=this.btnPageCssClass,k.add(n,"click",d.first),i.appendChild(n)}}this.pagingTgtId||c.SetTopDiv();var o=this.pagingTgtId?h.id(this.pagingTgtId):c.mDiv;o.appendChild(i),o.appendChild(f);var p=h.create("span",["id",c.prfxPgBeforeSpan+c.id]);p.appendChild(h.text(this.pageText)),p.className=this.nbPgSpanCssClass,o.appendChild(p),o.appendChild(a);var q=h.create("span",["id",c.prfxPgAfterSpan+c.id]);q.appendChild(h.text(this.ofText)),q.className=this.nbPgSpanCssClass,o.appendChild(q);var r=h.create("span",["id",c.prfxPgSpan+c.id]);r.className=this.nbPgSpanCssClass,r.appendChild(h.text(" "+this.nbPages+" ")),o.appendChild(r),o.appendChild(e),o.appendChild(g),this.pagingSlc=h.id(c.prfxSlcPages+c.id),(!c.rememberGridValues||this.isPagingRemoved)&&this.setPagingInfo(),c.fltGrid||(c.ValidateAllRows(),this.setPagingInfo(c.validRowsIndex)),this.isPagingRemoved=!1}},addPaging:{writable:!0,value:function(a){void 0===a&&(a=!1);var b=this.tf;b.hasGrid&&!b.paging&&(b.paging=!0,this.isPagingRemoved=!0,this.init(),b.ResetValues(),a&&b.Filter())}},setPagingInfo:{writable:!0,value:function(a){var b=this.tf,c=b.tbl.rows,d=this.pagingTgtId?h.id(this.pagingTgtId):b.mDiv,e=h.id(b.prfxPgSpan+b.id);if(a&&a.length>0)b.validRowsIndex=a;else{b.validRowsIndex=[];for(var f=b.refRow;f0)if(d.style.visibility="visible",this.pageSelectorType===b.fltTypeSlc)for(var j=0;j=this.startPagingRow&&d>e?("true"!==f.getAttribute("validRow")&&f.getAttribute("validRow")||(f.style.display=""),b.alternateBgs&&b.Cpt.alternateRows&&b.Cpt.alternateRows.setRowBg(b.validRowsIndex[e],e)):(f.style.display="none",b.alternateBgs&&b.Cpt.alternateRows&&b.Cpt.alternateRows.removeRowBg(b.validRowsIndex[e]))}b.nbVisibleRows=b.validRowsIndex.length,b.isStartBgAlternate=!1,b.ApplyGridProps()}},setPage:{writable:!0,value:function(a){var b=this.tf;if(b.hasGrid&&this.paging){var c=this.evt,d=typeof a;if("string"===d)switch(j.lower(a)){case"next":c.next();break;case"previous":c.prev();break;case"last":c.last();break;case"first":c.first();break;default:c.next()}else"number"===d&&this.changePage(a-1)}}},setResultsPerPage:{writable:!0,value:function(){var a=this,b=this.tf,c=this.evt;if((b.hasGrid||b.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){c.slcResultsChange=function(b){a.changeResultsPerPage(),b.target.blur()};var d=h.create(b.fltTypeSlc,["id",b.prfxSlcResults+b.id]);d.className=b.resultsSlcCssClass;var e=this.resultsPerPage[0],f=this.resultsPerPage[1],g=h.create("span",["id",b.prfxSlcResultsTxt+b.id]);g.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||b.SetTopDiv();var i=this.resultsPerPageTgtId?h.id(this.resultsPerPageTgtId):b.rDiv;g.appendChild(h.text(e)),i.appendChild(g),i.appendChild(d),this.resultsPerPageSlc=h.id(b.prfxSlcResults+b.id);for(var j=0;j=0&&a<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,a),this.currentPageNb=parseInt(a,10)+1,this.pageSelectorType===b.fltTypeSlc?this.pagingSlc.options[a].selected=!0:this.pagingSlc.value=this.currentPageNb,b.rememberPageNb&&b.Cpt.store.savePageNb(b.pgNbCookie),this.startPagingRow=this.pageSelectorType===b.fltTypeSlc?this.pagingSlc.value:a*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,a)))}},_changeResultsPerPage:{writable:!0,value:function(){var a=this.tf;if(a.paging){var b=this.resultsPerPageSlc,c=this.pageSelectorType===a.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(b.options[b.selectedIndex].value,10),this.startPagingRow=this.pagingLength*c,!isNaN(this.pagingLength)){if(this.startPagingRow>=a.nbFilterableRows&&(this.startPagingRow=a.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===a.fltTypeSlc){var d=this.pagingSlc.options.length-1<=c?this.pagingSlc.options.length-1:c;this.pagingSlc.options[d].selected=!0}a.rememberPageLen&&a.Cpt.store.savePageLength(a.pgLenCookie)}}}},_resetPage:{writable:!0,value:function(a){var b=this.tf,c=b.Cpt.store.getPageNb(a);""!==c&&this.changePage(c-1)}},_resetPageLength:{writable:!0,value:function(a){var b=this.tf;if(b.paging){var c=b.Cpt.store.getPageLength(a);""!==c&&(this.resultsPerPageSlc.options[c].selected=!0,this.changeResultsPerPage())}}},destroy:{writable:!0,value:function(){var a=this.tf;if(a.hasGrid){var b,c,d,e,f,g,i;b=h.id(a.prfxBtnNextSpan+a.id),c=h.id(a.prfxBtnPrevSpan+a.id),d=h.id(a.prfxBtnLastSpan+a.id),e=h.id(a.prfxBtnFirstSpan+a.id),f=h.id(a.prfxPgBeforeSpan+a.id),g=h.id(a.prfxPgAfterSpan+a.id),i=h.id(a.prfxPgSpan+a.id);var j=this.evt;this.pagingSlc&&(this.pageSelectorType===a.fltTypeSlc?k.remove(this.pagingSlc,"change",j.slcPagesChange):this.pageSelectorType===a.fltTypeInp&&k.remove(this.pagingSlc,"keypress",j._detectKey),this.pagingSlc.parentNode.removeChild(this.pagingSlc)),b&&(k.remove(b,"click",j.next),b.parentNode.removeChild(b)),c&&(k.remove(c,"click",j.prev),c.parentNode.removeChild(c)),d&&(k.remove(d,"click",j.last),d.parentNode.removeChild(d)),e&&(k.remove(e,"click",j.first),e.parentNode.removeChild(e)),f&&f.parentNode.removeChild(f),g&&g.parentNode.removeChild(g),i&&i.parentNode.removeChild(i),this.hasResultsPerPage&&this.removeResultsPerPage(),this.pagingSlc=null,this.nbPages=0,this.isPagingRemoved=!0,a.paging=!1}}}}),a}();a.Paging=l}),define("modules/clearButton",["exports","../dom","../event"],function(a,b,c){var d=function(a,b,c){b&&Object.defineProperties(a,b),c&&Object.defineProperties(a.prototype,c)},e=b.Dom,f=c.Event,g=function(){var a=function(a){var b=a.fObj;this.btnResetTgtId=b.btn_reset_target_id||null,this.btnResetEl=null,this.btnResetText=b.btn_reset_text||"Reset",this.btnResetTooltip=b.btn_reset_tooltip||"Clear filters",this.btnResetHtml=b.btn_reset_html||(a.enableIcons?'':null),this.tf=a};return d(a,null,{onClick:{writable:!0,value:function(){this.tf.ClearFilters()}},init:{writable:!0,value:function(){var a=this,b=this.tf;if(b.hasGrid||b.isFirstLoad||!b.btnResetEl){var c=e.create("span",["id",b.prfxResetSpan+b.id]);this.btnResetTgtId||b.SetTopDiv();var d=this.btnResetTgtId?e.id(this.btnResetTgtId):b.rDiv;if(d.appendChild(c),this.btnResetHtml){c.innerHTML=this.btnResetHtml;var g=c.firstChild;f.add(g,"click",function(){a.onClick()})}else{var h=e.create("a",["href","javascript:void(0);"]);h.className=b.btnResetCssClass,h.appendChild(e.text(this.btnResetText)),c.appendChild(h),f.add(h,"click",function(){a.onClick()})}this.btnResetEl=c.firstChild}}},destroy:{writable:!0,value:function(){var a=this.tf;if(a.hasGrid&&this.btnResetEl){var b=e.id(a.prfxResetSpan+a.id);b&&b.parentNode.removeChild(b),this.btnResetEl=null}}}}),a}();a.ClearButton=g}),define("modules/help",["exports","../dom","../event"],function(a,b,c){var d=function(a,b,c){b&&Object.defineProperties(a,b),c&&Object.defineProperties(a.prototype,c)},e=b.Dom,f=c.Event,g=function(){var a=function(a){var b=a.fObj||{};this.helpInstrTgtId=b.help_instructions_target_id||null,this.helpInstrContTgtId=b.help_instructions_container_target_id||null,this.helpInstrText=b.help_instructions_text?b.help_instructions_text:'Use the filters above each column to filter and limit table data. Avanced searches can be performed by using the following operators:
<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
These operators are described here:
http://tablefilter.free.fr/#operators
',this.helpInstrHtml=b.help_instructions_html||null,this.helpInstrBtnText=b.help_instructions_btn_text||"?",this.helpInstrBtnHtml=b.help_instructions_btn_html||null,this.helpInstrBtnCssClass=b.help_instructions_btn_css_class||"helpBtn",this.helpInstrContCssClass=b.help_instructions_container_css_class||"helpCont",this.helpInstrBtnEl=null,this.helpInstrContEl=null,this.helpInstrDefaultHtml='

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

http://tablefilter.free.fr
©2009-'+a.year+' Max Guglielmi.
',this.tf=a};return d(a,null,{init:{writable:!0,value:function(){var a=this;if(!this.helpInstrBtnEl){var b=this.tf,c=e.create("span",["id",b.prfxHelpSpan+b.id]),d=e.create("div",["id",b.prfxHelpDiv+b.id]);this.helpInstrTgtId||b.SetTopDiv();var g=this.helpInstrTgtId?e.id(this.helpInstrTgtId):b.rDiv;g.appendChild(c);var h=this.helpInstrContTgtId?e.id(this.helpInstrContTgtId):c;if(this.helpInstrBtnHtml){c.innerHTML=this.helpInstrBtnHtml;var i=c.firstChild;f.add(i,"click",function(){a.toggle()}),h.appendChild(d)}else{h.appendChild(d);var j=e.create("a",["href","javascript:void(0);"]);j.className=this.helpInstrBtnCssClass,j.appendChild(e.text(this.helpInstrBtnText)),c.appendChild(j),f.add(j,"click",function(){a.toggle()})}this.helpInstrHtml?(this.helpInstrContTgtId&&h.appendChild(d),d.innerHTML=this.helpInstrHtml,this.helpInstrContTgtId||(d.className=this.helpInstrContCssClass,f.add(d,"dblclick",function(){a.toggle()}))):(d.innerHTML=this.helpInstrText,d.className=this.helpInstrContCssClass,f.add(d,"dblclick",function(){a.toggle()})),d.innerHTML+=this.helpInstrDefaultHtml,f.add(d,"click",function(){a.toggle()}),this.helpInstrContEl=d,this.helpInstrBtnEl=c}}},toggle:{writable:!0,value:function(){if(this.helpInstrContEl){var a=this.helpInstrContEl.style.display;if(""===a||"none"===a){this.helpInstrContEl.style.display="block";var b=e.position(this.helpInstrBtnEl).left;this.helpInstrContTgtId||(this.helpInstrContEl.style.left=b-this.helpInstrContEl.clientWidth+25+"px")}else this.helpInstrContEl.style.display="none"}}},destroy:{writable:!0,value:function(){this.helpInstrBtnEl&&(this.helpInstrBtnEl.parentNode.removeChild(this.helpInstrBtnEl),this.helpInstrBtnEl=null,this.helpInstrContEl&&(this.helpInstrContEl.parentNode.removeChild(this.helpInstrContEl),this.helpInstrContEl=null))}}}),a}();a.Help=g}),define("modules/alternateRows",["exports","../dom"],function(a,b){var c=function(a,b,c){b&&Object.defineProperties(a,b),c&&Object.defineProperties(a.prototype,c)},d=b.Dom,e=function(){var a=function(a){var b=a.fObj;this.evenCss=b.even_row_css_class||"even",this.oddCss=b.odd_row_css_class||"odd",this.tf=a};return c(a,null,{init:{writable:!0,value:function(){if(this.tf.hasGrid||this.tf.isFirstLoad)for(var a=(this.tf.tbl.rows,null===this.tf.validRowsIndex),b=a?this.tf.refRow:0,c=a?this.tf.nbFilterableRows+b:this.tf.validRowsIndex.length,d=0,e=b;c>e;e++){var f=a?e:this.tf.validRowsIndex[e];this.setRowBg(f,d),d++}}},setRowBg:{writable:!0,value:function(a,b){if(this.tf.alternateBgs&&!isNaN(a)){var c=this.tf.tbl.rows,e=b?b:a;this.removeRowBg(a),d.addClass(c[a],e%2?this.evenCss:this.oddCss)}}},removeRowBg:{writable:!0,value:function(a){if(!isNaN(a)){var b=this.tf.tbl.rows;d.removeClass(b[a],this.oddCss),d.removeClass(b[a],this.evenCss)}}},remove:{writable:!0,value:function(){if(this.tf.hasGrid){for(var a=(this.tf.tbl.rows,this.tf.refRow);a=jj;jj++)ucolIndex[jj]===colIndex[ii]&&(saved=1);0===saved&&(ucolMax++,ucolIndex[ucolMax]=colIndex[ii])}if("object"==Str.lower(typeof labelId)&&"object"==Str.lower(typeof colIndex)&&"object"==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.id(labThisCol[i]))switch(Str.lower(oTypeThisCol)){case"innerhtml":Dom.id(labThisCol[i]).innerHTML=isNaN(result)||!isFinite(result)||0===nbvalues?".":result;break;case"setvalue":Dom.id(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=Dom.id(labThisCol[i]).firstChild,txtnode=Dom.text(result);Dom.id(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{Dom.id(labThisCol[i]).innerHTML=isNaN(result)||!isFinite(result)||0===nbvalues?".":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}),define("core",["require","event","dom","string","cookie","types","array","helpers","date","sort","modules/store","modules/gridLayout","modules/loader","modules/highlightKeywords","modules/popupFilter","modules/dropdown","modules/checkList","modules/rowsCounter","modules/statusBar","modules/paging","modules/clearButton","modules/help","modules/alternateRows","modules/colOps","modules/help"],function(a){function b(a){if(0!==arguments.length){if(this.id=a,this.version="3.0",this.year=(new Date).getFullYear(),this.tbl=h.id(a),this.startRow=null,this.refRow=null,this.headersRow=null,this.fObj=null,this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this.hasGrid=!1,this.enableModules=!1,!this.tbl||"table"!==k.lower(this.tbl.nodeName)||0===this.GetRowsNb())throw new Error("Could not instantiate TF object: HTML table not found.");if(arguments.length>1)for(var b=0;b1?this.filtersRowIndex=this.headersRow+1:(this.filtersRowIndex=1,this.headersRow=0)),this.fltCellTag="th"!==i.filters_cell_tag||"td"!==i.filters_cell_tag?"td":i.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=i.inf_div_css_class||"inf",this.lDivCssClass=i.left_div_css_class||"ldiv",this.rDivCssClass=i.right_div_css_class||"rdiv",this.mDivCssClass=i.middle_div_css_class||"mdiv",this.contDivCssClass=i.content_div_css_class||"cont",this.stylesheet=i.stylesheet||this.basePath+"filtergrid.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=i.flts_row_css_class||"fltrow",this.enableIcons=i.enable_icons===!1?!1:!0,this.alternateBgs=i.alternate_rows===!0?!0:!1,this.hasColWidth=i.col_width===!0?!0:!1,this.colWidth=this.hasColWidth?i.col_width:null,this.fixedHeaders=i.fixed_headers===!0?!0:!1,this.tBodyH=isNaN(i.tbody_height)?200:i.tbody_height,this.fltCssClass=i.flt_css_class||"flt",this.fltMultiCssClass=i.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=i.flt_small_css_class||"flt_s",this.singleFltCssClass=i.single_flt_css_class||"single_flt",this.isStartBgAlternate=!0,this.enterKey=i.enter_key===!1?!1:!0,this.isModFilterFn=i.mod_filter_fn===!0?!0:!1,this.modFilterFn=this.isModFilterFn?i.mod_filter_fn:null,this.onBeforeFilter=m.isFn(i.on_before_filter)?i.on_before_filter:null,this.onAfterFilter=m.isFn(i.on_after_filter)?i.on_after_filter:null,this.matchCase=i.match_case===!0?!0:!1,this.exactMatch=i.exact_match===!0?!0:!1,this.refreshFilters=i.refresh_filters===!0?!0:!1,this.disableExcludedOptions=i.disable_excluded_options===!0?!0:!1,this.activeFlt=null,this.activeFilterId=null,this.hasColOperation=i.col_operation?!0:!1,this.colOperation=null,this.hasVisibleRows=i.rows_always_visible?!0:!1,this.visibleRows=this.hasVisibleRows?i.rows_always_visible:[],this.searchType=i.search_type||"include",this.isExternalFlt=i.external_flt_grid===!0?!0:!1,this.externalFltTgtIds=i.external_flt_grid_ids||null,this.externalFltEls=[],this.execDelay=isNaN(i.exec_delay)?100:parseInt(i.exec_delay,10),this.onFiltersLoaded=m.isFn(i.on_filters_loaded)?i.on_filters_loaded:null,this.singleSearchFlt=i.single_search_filter===!0?!0:!1,this.onRowValidated=m.isFn(i.on_row_validated)?i.on_row_validated:null,this.customCellDataCols=i.custom_cell_data_cols?i.custom_cell_data_cols:[],this.customCellData=m.isFn(i.custom_cell_data)?i.custom_cell_data:null,this.watermark=i.watermark||"",this.isWatermarkArray=m.isArray(this.watermark),this.toolBarTgtId=i.toolbar_target_id||null,this.helpInstructions=i.help_instructions||!1,this.popUpFilters=i.popup_filters===!0?!0:!1,this.markActiveColumns=i.mark_active_columns===!0?!0:!1,this.activeColumnsCssClass=i.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=m.isFn(i.on_before_active_column)?i.on_before_active_column:null,this.onAfterActiveColumn=m.isFn(i.on_after_active_column)?i.on_after_active_column:null,this.displayAllText=i.display_all_text||"",this.enableEmptyOption=i.enable_empty_option===!0?!0:!1,this.emptyText=i.empty_text||"(Empty)",this.enableNonEmptyOption=i.enable_non_empty_option===!0?!0:!1,this.nonEmptyText=i.non_empty_text||"(Non empty)",this.onSlcChange=i.on_change===!1?!1:!0,this.sortSlc=i.sort_select===!1?!1:!0,this.isSortNumAsc=i.sort_num_asc===!0?!0:!1,this.sortNumAsc=this.isSortNumAsc?i.sort_num_asc:null,this.isSortNumDesc=i.sort_num_desc===!0?!0:!1,this.sortNumDesc=this.isSortNumDesc?i.sort_num_desc:null,this.fillSlcOnDemand=i.fill_slc_on_demand===!0?!0:!1,this.hasCustomSlcOptions=m.isObj(i.custom_slc_options)?!0:!1,this.customSlcOptions=m.isArray(i.custom_slc_options)?i.custom_slc_options:null,this.rgxOperator=i.regexp_operator||"rgx:",this.emOperator=i.empty_operator||"[empty]",this.nmOperator=i.nonempty_operator||"[nonempty]",this.orOperator=i.or_operator||"||",this.anOperator=i.and_operator||"&&",this.grOperator=i.greater_operator||">",this.lwOperator=i.lower_operator||"<",this.leOperator=i.lower_equal_operator||"<=",this.geOperator=i.greater_equal_operator||">=",this.dfOperator=i.different_operator||"!",this.lkOperator=i.like_operator||"*",this.eqOperator=i.equal_operator||"=",this.stOperator=i.start_with_operator||"{",this.enOperator=i.end_with_operator||"}",this.curExp=i.cur_exp||"^[¥£€$]",this.separator=i.separator||",",this.rowsCounter=i.rows_counter===!0?!0:!1,this.statusBar=i.status_bar===!0?!0:!1,this.loader=i.loader===!0?!0:!1,this.displayBtn=i.btn===!0?!0:!1,this.btnText=i.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=i.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=i.btn_reset===!0?!0:!1,this.btnResetCssClass=i.btn_reset_css_class||"reset",this.onBeforeReset=m.isFn(i.on_before_reset)?i.on_before_reset:null,this.onAfterReset=m.isFn(i.on_after_reset)?i.on_after_reset:null,this.paging=i.paging===!0?!0:!1,this.nbVisibleRows=0,this.nbHiddenRows=0,this.sort=i.sort===!0?!0:!1,this.isSortEnabled=!1,this.sorted=!1,this.sortConfig=i.sort_config||{},this.sortConfig.name=void 0!==this.sortConfig.name?i.sort_config.name:"sortabletable",this.sortConfig.src=void 0!==this.sortConfig.src?i.sort_config.src:this.basePath+"sortabletable.js",this.sortConfig.adapterSrc=void 0!==this.sortConfig.adapter_src?i.sort_config.adapter_src:this.basePath+"tfAdapter.sortabletable.js",this.sortConfig.initialize=void 0!==this.sortConfig.initialize?i.sort_config.initialize:function(a){a.SetSortTable&&a.SetSortTable() -},this.sortConfig.sortTypes=m.isArray(this.sortConfig.sort_types)?i.sort_config.sort_types:[],this.sortConfig.sortCol=void 0!==this.sortConfig.sort_col?i.sort_config.sort_col:null,this.sortConfig.asyncSort=this.sortConfig.async_sort===!0?!0:!1,this.sortConfig.triggerIds=m.isArray(this.sortConfig.sort_trigger_ids)?i.sort_config.sort_trigger_ids:[],this.selectable=i.selectable===!0?!0:!1,this.editable=i.editable===!0?!0:!1,this.ezEditTableConfig=i.ezEditTable_config||{},this.ezEditTableConfig.name=void 0!==this.ezEditTableConfig.name?i.ezEditTable_config.name:"ezedittable",this.ezEditTableConfig.src=void 0!==this.ezEditTableConfig.src?i.ezEditTable_config.src:this.basePath+"ezEditTable/ezEditTable.js",this.ezEditTableConfig.loadStylesheet=this.ezEditTableConfig.loadStylesheet===!0?!0:!1,this.ezEditTableConfig.stylesheet=this.ezEditTableConfig.stylesheet||this.basePath+"ezEditTable/ezEditTable.css",this.ezEditTableConfig.stylesheetName=void 0!==this.ezEditTableConfig.stylesheetName?i.ezEditTable_config.stylesheetName:"ezEditTableCss",this.ezEditTableConfig.err='Failed to instantiate EditTable object.\n"ezEditTable" module may not be available.',this.onKeyUp=i.on_keyup===!0?!0:!1,this.onKeyUpDelay=isNaN(i.on_keyup_delay)?900:i.on_keyup_delay,this.isUserTyping=null,this.onKeyUpTimer=void 0,this.highlightKeywords=i.highlight_keywords===!0?!0:!1,this.defaultDateType=i.default_date_type||"DMY",this.thousandsSeparator=i.thousands_separator||",",this.decimalSeparator=i.decimal_separator||".",this.hasColNbFormat=i.col_number_format===!0?!0:!1,this.colNbFormat=m.isArray(this.hasColNbFormat)?i.col_number_format:null,this.hasColDateType=i.col_date_type===!0?!0:!1,this.colDateType=m.isArray(this.hasColDateType)?i.col_date_type:null,this.msgFilter=i.msg_filter||"Filtering data...",this.msgPopulate=i.msg_populate||"Populating filter...",this.msgPopulateCheckList=i.msg_populate_checklist||"Populating list...",this.msgChangePage=i.msg_change_page||"Collecting paging data...",this.msgClear=i.msg_clear||"Clearing filters...",this.msgChangeResults=i.msg_change_results||"Changing results per page...",this.msgResetValues=i.msg_reset_grid_values||"Re-setting filters values...",this.msgResetPage=i.msg_reset_page||"Re-setting page...",this.msgResetPageLength=i.msg_reset_page_length||"Re-setting page length...",this.msgSort=i.msg_sort||"Sorting data...",this.msgLoadExtensions=i.msg_load_extensions||"Loading extensions...",this.msgLoadThemes=i.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.prfxContentDiv="cont_",this.prfxCheckListDiv="chkdiv_",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_",this.prfxCounter="counter_",this.prfxTotRows="totrows_span_",this.prfxTotRowsTxt="totRowsTextSpan_",this.prfxResetSpan="resetspan_",this.prfxLoader="load_",this.prfxStatus="status_",this.prfxStatusSpan="statusSpan_",this.prfxStatusTxt="statusText_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.prfxMainTblCont="gridCont_",this.prfxTblCont="tblCont_",this.prfxHeadTblCont="tblHeadCont_",this.prfxHeadTbl="tblHead_",this.prfxGridFltTd="_td_",this.prfxGridTh="tblHeadTh_",this.prfxHelpSpan="helpSpan_",this.prfxHelpDiv="helpDiv_",this.prfxPopUpSpan="popUpSpan_",this.prfxPopUpDiv="popUpDiv_",this.hasStoredValues=!1,this.rememberGridValues=i.remember_grid_values===!0?!0:!1,this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&i.remember_page_number?!0:!1,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&i.remember_page_length?!0:!1,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.hasExtensions=i.extensions===!0?!0:!1,this.extensions=this.hasExtensions?i.extensions:null,this.enableDefaultTheme=i.enable_default_theme===!0?!0:!1,this.hasThemes=i.enable_default_theme||i.themes&&m.isObj(i.themes)?!0:!1,this.themes=this.hasThemes?i.themes:null,this.themesPath=i.themes_path||this.basePath+"TF_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};var p=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"},getKeyCode:function(a){return a.charCode?a.charCode:a.keyCode?a.keyCode:a.which?a.which:0},_DetectKey:function(a){if(p.enterKey){var b=a||f.event;if(b){var c=p.Evt.getKeyCode(b);13===c?(p._Filter(),g.cancel(b),g.stop(b)):(p.isUserTyping=!0,f.clearInterval(p.onKeyUpTimer),p.onKeyUpTimer=void 0)}}},_OnKeyUp:function(a){function b(){f.clearInterval(p.onKeyUpTimer),p.onKeyUpTimer=void 0,p.isUserTyping||(p.Filter(),p.isUserTyping=null)}if(p.onKeyUp){var c=a||f.event,d=p.Evt.getKeyCode(c);p.isUserTyping=!1,13!==d&&9!==d&&27!==d&&38!==d&&40!==d?void 0===p.onKeyUpTimer&&(p.onKeyUpTimer=f.setInterval(b,p.onKeyUpDelay)):(f.clearInterval(p.onKeyUpTimer),p.onKeyUpTimer=void 0)}},_OnKeyDown:function(){p.onKeyUp&&(p.isUserTyping=!0)},_OnInpBlur:function(){p.onKeyUp&&(p.isUserTyping=!1,f.clearInterval(p.onKeyUpTimer)),p.ezEditTable&&(p.editable&&p.ezEditTable.Editable.Set(),p.selectable&&p.ezEditTable.Selection.Set())},_OnInpFocus:function(a){var b=a||f.event;p.activeFilterId=this.getAttribute("id"),p.activeFlt=h.id(p.activeFilterId),p.popUpFilters&&(g.cancel(b),g.stop(b)),p.ezEditTable&&(p.editable&&p.ezEditTable.Editable.Remove(),p.selectable&&p.ezEditTable.Selection.Remove())},_OnSlcFocus:function(a){var b=a||f.event;if(p.activeFilterId=this.getAttribute("id"),p.activeFlt=h.id(p.activeFilterId),p.fillSlcOnDemand&&"0"===this.getAttribute("filled")){var c=this.getAttribute("ct");p.Cpt.dropdown._build(c)}p.popUpFilters&&(g.cancel(b),g.stop(b))},_OnSlcChange:function(a){if(p.activeFlt){var b=(p.activeFlt.getAttribute("colIndex"),a||f.event);p.popUpFilters&&g.stop(b),p.onSlcChange&&p.Filter()}},_OnSlcBlur:function(){},_OnCheckListClick:function(){if(p.fillSlcOnDemand&&"0"===this.getAttribute("filled")){var a=this.getAttribute("ct");p.Cpt.checkList._build(a),p.Cpt.checkList.checkListDiv[a].onclick=null,p.Cpt.checkList.checkListDiv[a].title=""}},_OnCheckListFocus:function(){p.activeFilterId=this.firstChild.getAttribute("id"),p.activeFlt=h.id(p.activeFilterId)},_OnCheckListBlur:function(){},_OnBtnClick:function(){p.Filter()},_OnSlcPagesChangeEvt:null,_EnableSlc:function(){this.firstChild.disabled=!1,this.firstChild.focus(),this.onclick=null},_Paging:{nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null}}}}function c(a,b){if(a){b||(b="us");var c=a;return c="us"===k.lower(b)?+c.replace(/[^\d\.-]/g,""):+c.replace(/[^\d\,-]/g,"").replace(",",".")}}function d(a,b){for(var c=!1,d=b?b:"script",e="script"==d?"src":"href",f=h.tag(s,d),g=0;g0?n[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&!this.popUpFilters&&this.headersRow++,this.popUpFilters&&this.headersRow++,m.className=this.fltsRowCssClass,this.isExternalFlt&&(!this.gridLayout||this.popUpFilters)&&(m.style.display="none")}this.nbFilterableRows=this.GetRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var o=0;d>o;o++){this.popUpFilters&&this.Cpt.popupFilter.build(o);var p=h.create(this.fltCellTag),q=this["col"+o],r=this.isExternalFlt&&this.externalFltTgtIds?this.externalFltTgtIds[o]:null;if(this.singleSearchFlt&&(p.colSpan=this.nbCells),this.gridLayout||m.appendChild(p),b=o==d-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,void 0===q&&(q=void 0===c["col_"+o]?this.fltTypeInp:k.lower(c["col_"+o])),this.singleSearchFlt&&(q=this.fltTypeInp,b=this.singleFltCssClass),q===this.fltTypeSlc||q===this.fltTypeMulti){var s;if(!this.Cpt.dropdown){var t=a("modules/dropdown").Dropdown;s=new t(this)}this.Cpt.dropdown=s;var u=h.create(this.fltTypeSlc,["id",this.prfxFlt+o+"_"+this.id],["ct",o],["filled","0"]);if(q===this.fltTypeMulti&&(u.multiple=this.fltTypeMulti,u.title=s.multipleSlcTooltip),u.className=k.lower(q)===this.fltTypeSlc?b:this.fltMultiCssClass,r?(h.id(r).appendChild(u),this.externalFltEls.push(u)):p.appendChild(u),this.fltIds.push(this.prfxFlt+o+"_"+this.id),this.fillSlcOnDemand||s._build(o),g.add(u,"keypress",this.Evt._DetectKey),g.add(u,"change",this.Evt._OnSlcChange),g.add(u,"focus",this.Evt._OnSlcFocus),g.add(u,"blur",this.Evt._OnSlcBlur),this.fillSlcOnDemand){var v=h.createOpt(this.displayAllText,"");u.appendChild(v)}}else if(q===this.fltTypeCheckList){if(!this.Cpt.checkList){var w=a("modules/checkList").CheckList;this.Cpt.checkList=new w(this)}var x=h.create("div",["id",this.prfxCheckListDiv+o+"_"+this.id],["ct",o],["filled","0"]);x.className=this.Cpt.checkList.checkListDivCssClass,r?(h.id(r).appendChild(x),this.externalFltEls.push(x)):p.appendChild(x),this.Cpt.checkList.checkListDiv[o]=x,this.fltIds.push(this.prfxFlt+o+"_"+this.id),this.fillSlcOnDemand||this.Cpt.checkList._build(o),this.fillSlcOnDemand&&(g.add(x,"click",this.Evt._OnCheckListClick),x.appendChild(h.text(this.Cpt.checkList.activateCheckListTxt))),g.add(x,"click",this.Evt._OnCheckListFocus)}else{var y=q===this.fltTypeInp?"text":"hidden",z=h.create(this.fltTypeInp,["id",this.prfxFlt+o+"_"+this.id],["type",y],["ct",o]);if("hidden"!==y&&this.watermark&&z.setAttribute("placeholder",this.isWatermarkArray?this.watermark[o]:this.watermark),z.className=b,z.onfocus=this.Evt._OnInpFocus,r?(h.id(r).appendChild(z),this.externalFltEls.push(z)):p.appendChild(z),this.fltIds.push(this.prfxFlt+o+"_"+this.id),z.onkeypress=this.Evt._DetectKey,z.onkeydown=this.Evt._OnKeyDown,z.onkeyup=this.Evt._OnKeyUp,z.onblur=this.Evt._OnInpBlur,this.rememberGridValues){var A=this.Cpt.store.getFilterValues(this.fltsValuesCookie);" "!=A[o]&&this.SetFilterValue(o,A[o],!1)}}if(o==d-1&&this.displayBtn){var B=h.create(this.fltTypeInp,["id",this.prfxValButton+o+"_"+this.id],["type","button"],["value",this.btnText]);B.className=this.btnCssClass,r?h.id(r).appendChild(B):p.appendChild(B),B.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;if(this.rowsCounter){var C=a("modules/rowsCounter").RowsCounter;this.Cpt.rowsCounter=new C(this),this.Cpt.rowsCounter.init()}if(this.statusBar){var D=a("modules/statusBar").StatusBar;this.Cpt.statusBar=new D(this),this.Cpt.statusBar.init()}if(this.paging){var E=a("modules/paging").Paging;this.Cpt.paging=new E(this),this.Cpt.paging.init()}if(this.btnReset){var F=a("modules/clearButton").ClearButton;this.Cpt.clearButton=new F(this),this.Cpt.clearButton.init()}if(this.helpInstructions){var G=a("modules/help").Help;this.Cpt.help=new G(this),this.Cpt.help.init()}if(this.hasColWidth&&!this.gridLayout&&this.SetColWidths(),this.alternateBgs){var H=a("modules/alternateRows").AlternateRows;this.Cpt.alternateRows=new H(this),this.Cpt.alternateRows.init()}if(this.hasColOperation){var I=a("modules/colOps").ColOps;this.Cpt.colOps=new I(this),this.Cpt.colOps.calc()}(this.sort||this.gridLayout)&&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.addClass(this.tbl,this.prfxTf),this.loader&&this.Cpt.loader.show("none"),this.hasExtensions&&this.LoadExtensions(),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this)}},EvtManager:function(a,b){function c(){if(a){switch(a){case d.Evt.name.filter:d.isModFilterFn?d.modFilterFn.call(null,d):d._Filter();break;case d.Evt.name.dropdown:d.refreshFilters?d.Cpt.dropdown._build(e,!0):d.Cpt.dropdown._build(e,!1,g,h);break;case d.Evt.name.checklist:d.Cpt.checkList._build(e,g,h);break;case d.Evt.name.changepage:d.Cpt.paging._changePage(i);break;case d.Evt.name.clear:d._ClearFilters(),d._Filter();break;case d.Evt.name.changeresultsperpage:d.Cpt.paging._changeResultsPerPage();break;case d.Evt.name.resetvalues:d._ResetValues(),d._Filter();break;case d.Evt.name.resetpage:d.Cpt.paging._resetPage(d.pgNbCookie);break;case d.Evt.name.resetpagelength:d.Cpt.paging._resetPageLength(d.pgLenCookie);break;case d.Evt.name.sort:break;case d.Evt.name.loadextensions:d._LoadExtensions();break;case d.Evt.name.loadthemes:d._LoadThemes();break;default:d["_"+a].call(null,d,b)}d.statusBar&&d.Cpt.statusBar.message(""),d.loader&&d.Cpt.loader.show("none")}}var d=this,e=b&&void 0!==b.slcIndex?b.slcIndex:null,g=b&&void 0!==b.slcExternal?b.slcExternal:!1,h=b&&void 0!==b.slcId?b.slcId:null,i=b&&void 0!==b.pgIndex?b.pgIndex:null;if(this.loader||this.statusBar){try{this.Cpt.loader.show(""),this.Cpt.statusBar.message(this["msg"+a])}catch(j){}f.setTimeout(c,this.execDelay)}else c()},ImportModule:function(a){a.path&&a.name&&this.IncludeFile(a.name,a.path,a.init)},LoadExtensions:function(){if(!this.Ext){var a=this;this.Ext={list:{},add:function(b,c,d,e){var f=d.split("/")[d.split("/").length-1],g=new RegExp(f),h=d.replace(g,"");a.Ext.list[b]={name:b,description:c,file:f,path:h,callback:e}}}}this.EvtManager(this.Evt.name.loadextensions)},_LoadExtensions:function(){if(this.hasExtensions&&m.isArray(this.extensions.name)&&m.isArray(this.extensions.src))for(var a=this.extensions,b=0;b',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null}},remove:function(){if(this.fltGrid&&this.hasGrid){var a=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.RemoveTopDiv(),this.highlightKeywords&&this.Cpt.highlightKeyword.unhighlightAll(),this.sort&&this.RemoveSort(),this.loader&&this.Cpt.loader.remove(),this.popUpFilters&&this.Cpt.popupFilter.destroy(),this.markActiveColumns&&this.ClearActiveColumns(),(this.editable||this.selectable)&&this.RemoveEditable();for(var b=this.refRow;b0&&!c.startRow?void 0:c.startRow||a.refRow,c.scroll_into_view=c.scroll_into_view===!1?!1:!0,c.base_path=c.base_path||a.basePath+"ezEditTable/",c.editable=a.editable=a.fObj.editable,c.selection=a.selectable=a.fObj.selectable,a.selectable&&(c.default_selection=c.default_selection||"row"),c.active_cell_css=c.active_cell_css||"ezETSelectedCell",a._lastValidRowIndex=0,a._lastRowIndex=0,a.selectable){var e=function(b,c,d){if(a.validRowsIndex){var e,f=a.validRowsIndex,g=f.length,h="row"!==b.defaultSelection?c.parentNode:c,i="TD"===c.nodeName?c:null,j=void 0!==d?b.Event.GetKey(d):0,k=n.has(f,h.rowIndex),l=34===j||33===j?a.pagingLength||b.nbRowsPerPage:1;if(k)34!==j&&33!==j?(a._lastValidRowIndex=n.indexByValue(f,h.rowIndex),a._lastRowIndex=h.rowIndex):(e=34===j?a._lastValidRowIndex+l<=g-1?f[a._lastValidRowIndex+l]:[g-1]:a._lastValidRowIndex-l<=f[0]?f[0]:f[a._lastValidRowIndex-l],a._lastRowIndex=e,a._lastValidRowIndex=n.indexByValue(f,e),p(e));else{if(h.rowIndex>a._lastRowIndex)if(h.rowIndex>=f[g-1])e=f[g-1];else{var m=a._lastValidRowIndex+l;e=m>g-1?f[g-1]:f[m]}else if(h.rowIndex<=f[0])e=f[0];else{var o=f[a._lastValidRowIndex-l];e=o?o:f[0]}a._lastRowIndex=h.rowIndex,p(e)}var p=function(d){if("row"===b.defaultSelection)b.Selection.SelectRowByIndex(d);else{b.ClearSelections();var e=c.cellIndex,f=a.tbl.rows[d];"both"===b.defaultSelection&&b.Selection.SelectRowByIndex(d),f&&b.Selection.SelectCell(f.cells[e])}if(a.validRowsIndex.length!==a.GetRowsNb()){var g=a.tbl.rows[d];g&&g.scrollIntoView(!1),i&&(i.cellIndex===a.GetCellsNb()-1&&a.gridLayout?a.tblCont.scrollLeft=1e8:0===i.cellIndex&&a.gridLayout?a.tblCont.scrollLeft=0:i.scrollIntoView(!1))}}}},f=function(b,c){var d="row"!==b.defaultSelection?c.parentNode:c;if(a.paging&&a.nbPages>1){b.nbRowsPerPage=a.pagingLength;var e=a.validRowsIndex,f=e.length,g=parseInt(a.startPagingRow,10)+parseInt(a.pagingLength,10),h=d.rowIndex;h===e[f-1]&&a.currentPageNb!=a.nbPages?a.Cpt.paging.setPage("last"):h==e[0]&&1!==a.currentPageNb?a.Cpt.paging.setPage("first"):h>e[g-1]&&he[0]&&a.Cpt.paging.setPage("previous")}};if(a.paging&&(a.onAfterChangePage=function(a){var b=a.ezEditTable,c=b.Selection.GetActiveRow();c&&c.scrollIntoView(!1);var d=b.Selection.GetActiveCell();d&&d.scrollIntoView(!1)}),"row"===c.default_selection){var g=c.on_before_selected_row;c.on_before_selected_row=function(){f(arguments[0],arguments[1],arguments[2]),g&&g.call(null,arguments[0],arguments[1],arguments[2])};var i=c.on_after_selected_row;c.on_after_selected_row=function(){e(arguments[0],arguments[1],arguments[2]),i&&i.call(null,arguments[0],arguments[1],arguments[2])}}else{var j=c.on_before_selected_cell;c.on_before_selected_cell=function(){f(arguments[0],arguments[1],arguments[2]),j&&j.call(null,arguments[0],arguments[1],arguments[2])};var k=c.on_after_selected_cell;c.on_after_selected_cell=function(){e(arguments[0],arguments[1],arguments[2]),k&&k.call(null,arguments[0],arguments[1],arguments[2])}}}if(a.editable){var l=c.on_added_dom_row;if(c.on_added_dom_row=function(){a.nbFilterableRows++,a.paging?(a.nbRows++,a.nbVisibleRows++,a.nbFilterableRows++,a.paging=!1,a.Cpt.paging.destroy(),a.Cpt.paging.addPaging()):a.Cpt.rowsCounter.refresh(),a.alternateBgs&&a.Cpt.alternateRows.init(),l&&l.call(null,arguments[0],arguments[1],arguments[2])},c.actions&&c.actions["delete"]){var m=c.actions["delete"].on_after_submit;c.actions["delete"].on_after_submit=function(){a.nbFilterableRows--,a.paging?(a.nbRows--,a.nbVisibleRows--,a.nbFilterableRows--,a.paging=!1,a.Cpt.paging.destroy(),a.Cpt.paging.addPaging(!1)):a.Cpt.rowsCounter.refresh(),a.alternateBgs&&a.Cpt.alternateRows.init(),m&&m.call(null,arguments[0],arguments[1])}}}try{a.ezEditTable=new EditTable(a.id,c,b),a.ezEditTable.Init()}catch(o){console.log(c.err)}},__deferMultipleSelection:function(a,b,c){if("select"===k.lower(a.nodeName)){var d=void 0===c?!1:c,e=this;f.setTimeout(function(){a.options[0].selected=!1,""===a.options[b].value?a.options[b].selected=!1:(a.options[b].selected=!0,d&&e.Filter())},.1)}},__getCustomValues:function(a){if(a){var b=this.hasCustomSlcOptions&&n.has(this.customSlcOptions.cols,a);if(b){for(var c=[],d=[],e=n.indexByValue(this.customSlcOptions.cols,a),f=this.customSlcOptions.values[e],g=this.customSlcOptions.texts[e],h=this.customSlcOptions.sorts[e],i=0;ih):P?(n=r(a.replace(l,""),J),f=n>=h):R?(n=r(a.replace(m,""),J),f=h>=n):Q?(n=r(a.replace(p,""),J),f=h>n):S?(n=r(a.replace(s,""),J),f=h.toString()!=n.toString()):T?(n=r(a.replace(u,""),J),f=h.toString()==n.toString()):t.test(a)?f=g.__containsStr(a.replace(t,""),b,null,!1):q(a,J)?(n=r(a,J),f=h.toString()==n.toString()):L?f=k.isEmpty(b):M&&(f=!k.isEmpty(b));else if(g.hasColNbFormat&&g.colNbFormat[d]?(i=c(b,g.colNbFormat[d]),j=g.colNbFormat[d]):","===g.thousandsSeparator&&"."===g.decimalSeparator?(i=c(b,"us"),j="us"):(i=c(b,"eu"),j="eu"),C)f=i<=c(a.replace(l,""),j);else if(E)f=i>=c(a.replace(m,""),j);else if(B)f=ic(a.replace(p,""),j);else if(F)f=g.__containsStr(a.replace(s,""),b)?!1:!0;else if(H)f=g.__containsStr(a.replace(t,""),b,null,!1);else if(G)f=g.__containsStr(a.replace(u,""),b,null,!0);else if(I)f=0===b.indexOf(a.replace(v,""))?!0:!1;else if(K){var U=a.replace(w,"");f=b.lastIndexOf(U,b.length-1)===b.length-1-(U.length-1)&&b.lastIndexOf(U,b.length-1)>-1?!0:!1}else if(L)f=k.isEmpty(b);else if(M)f=!k.isEmpty(b);else if(N)try{var V=a.replace(A,""),W=new RegExp(V);f=W.test(b)}catch(X){f=!1}else{var Y=e["col_"+d];f=g.__containsStr(a,b,Y?Y:this.fltTypeInp)}return f}if(this.fltGrid&&(this.hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this);var d=this.tbl.rows,e=this.fObj||{},f=0;this.validRowsIndex=[];var g=this;this.highlightKeywords&&this.Cpt.highlightKeyword.unhighlightAll(),this.popUpFilters&&this.Cpt.popupFilter.buildIcons(),this.markActiveColumns&&this.ClearActiveColumns(),this.searchArgs=this.GetFiltersValue();for(var i,j,l=new RegExp(this.leOperator),m=new RegExp(this.geOperator),o=new RegExp(this.lwOperator),p=new RegExp(this.grOperator),s=new RegExp(this.dfOperator),t=new RegExp(k.rgxEsc(this.lkOperator)),u=new RegExp(this.eqOperator),v=new RegExp(this.stOperator),w=new RegExp(this.enOperator),x=new RegExp(this.anOperator),y=(new RegExp(this.curExp),this.emOperator),z=this.nmOperator,A=new RegExp(k.rgxEsc(this.rgxOperator)),B=this.refRow;BH;H++){var I=this.searchArgs[this.singleSearchFlt?0:H],J=this.hasColDateType?this.colDateType[H]:this.defaultDateType;if(""!==I){var K=k.matchCase(this.GetCellData(H,C[H]),this.matchCase),L=I.split(this.orOperator),M=L.length>1?!0:!1,N=I.split(this.anOperator),O=N.length>1?!0:!1;if(M||O){for(var P,Q=!1,R=M?L:N,S=0;Sl;l++)if(l===a&&""===e[g].style.display){var o=k.lower(this.GetCellData(l,i[l])),p=this.colNbFormat?this.colNbFormat[a]:null,q=b?c(o,p):o;f.push(q)}}return f}},GetFilterValue:function(a){if(this.fltGrid){var b,c=this.GetFilterElement(a);if(!c)return"";var d=this.fltCol[a];if(d!==this.fltTypeMulti&&d!==this.fltTypeCheckList)b=c.value;else if(d===this.fltTypeMulti){b="";for(var e=0;e0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||q)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&q&&q[d]&&(i=q[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function d(b,c){return function(){var d=s.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),k.apply(a,d.concat([b,c]))}}function e(a){return function(b){return c(b,a)}}function f(a){return function(b){n[a]=b}}function g(c){if(b(o,c)){var d=o[c];delete o[c],q[c]=!0,j.apply(a,d)}if(!b(n,c)&&!b(q,c))throw new Error("No "+c);return n[c]}function h(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function i(a){return function(){return p&&p.config&&p.config[a]||{}}}var j,k,l,m,n={},o={},p={},q={},r=Object.prototype.hasOwnProperty,s=[].slice,t=/\.js$/;l=function(a,b){var d,f=h(a),i=f[0];return a=f[1],i&&(i=c(i,b),d=g(i)),i?a=d&&d.normalize?d.normalize(a,e(b)):c(a,b):(a=c(a,b),f=h(a),i=f[0],a=f[1],i&&(d=g(i))),{f:i?i+"!"+a:a,n:a,pr:i,p:d}},m={require:function(a){return d(a)},exports:function(a){var b=n[a];return"undefined"!=typeof b?b:n[a]={}},module:function(a){return{id:a,uri:"",exports:n[a],config:i(a)}}},j=function(c,e,h,i){var j,k,p,r,s,t,u=[],v=typeof h;if(i=i||c,"undefined"===v||"function"===v){for(e=!e.length&&h.length?["require","exports","module"]:e,s=0;s]+>/g,"");return b=b.replace(/^\s+/,"").replace(/\s+$/,"")},c.create=function(a){if(a&&""!==a){var b=document.createElement(a),c=arguments;if(c.length>1)for(var d=0;d0){var d=document.cookie,e=d.indexOf(c);if(-1!==e){e+=c.length;var f=d.indexOf(";",e);-1===f&&(f=d.length),b=unescape(d.substring(e,f))}}return b},b.remove=function(a){this.write(a,"",-1)},b.valueToArray=function(a,b){b||(b=",");var c=this.read(a),d=c.split(b);return d},b.getValueByIndex=function(a,b,c){c||(c=",");var d=this.valueToArray(a,c);return d[b]},a.Cookie=b}),define("types",["exports"],function(a){var b={},c=void 0;b.isObj=function(a){var b=!1;return"string"==typeof a?window[a]&&"object"==typeof window[a]&&(b=!0):a&&"object"==typeof a&&(b=!0),b},b.isFn=function(a){return a&&a.constructor==Function},b.isArray=function(a){return a&&a.constructor==Array},b.isUndef=function(a){return a===c},a.Types=b}),define("array",["exports","string"],function(a,b){var c=b.Str,d={has:function(a,b,d){for(var e=void 0===d?!1:d,f=0;f2)return a;var b;return 99>=a&&a>50&&(b="19"+a),(50>a||"00"===a)&&(b="20"+a),b}function d(a){if(void 0===a)return 0;for(var b,c=["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],d=0;d11||23>b)&&(b-=12),1>b||b>12?0:b}if(b||(b="DMY"),!a||""===a)return new Date(1001,0,1);var e,f;switch(b.toUpperCase()){case"DDMMMYYYY":f=a.replace(/[- \/.]/g," ").split(" "),e=new Date(c(f[2]),d(f[1])-1,f[0]);break;case"DMY":f=a.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),e=new Date(c(f[2]),f[1]-1,f[0]);break;case"MDY":f=a.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),e=new Date(c(f[2]),f[0]-1,f[1]);break;case"YMD":f=a.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,"$1 $4 $6").split(" "),e=new Date(c(f[0]),f[1]-1,f[2]);break;default:f=a.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,"$1 $3 $5").split(" "),e=new Date(c(f[2]),f[1]-1,f[0])}return e})};a.DateHelper=b}),define("sort",["exports","string"],function(a,b){var c=b.Str,d={ignoreCase:function(a,b){var d=c.lower(a),e=c.lower(b);return e>d?-1:d>e?1:0}};a.Sort=d}),define("modules/store",["exports","../cookie"],function(a,b){{var c=function(a,b,c){b&&Object.defineProperties(a,b),c&&Object.defineProperties(a.prototype,c)},d=function(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")},e=b.Cookie;a.Store=function(){function a(b){d(this,a);var c=b.config();this.duration=isNaN(c.set_cookie_duration)?1e5:parseInt(c.set_cookie_duration,10),this.tf=b}return c(a,null,{saveFilterValues:{value:function(a){for(var b=this.tf,c=[],d=0;d0&&c.removeChild(y[0]),this.headTbl.style.width=c.style.width,this.headTbl.style.tableLayout="fixed",c.style.tableLayout="fixed",this.headTbl.cellPadding=c.cellPadding,this.headTbl.cellSpacing=c.cellSpacing,a.setColWidths(),this.headTblCont.style.width=this.tblCont.clientWidth+"px",c.style.width="";var z=this;j.add(this.tblCont,"scroll",function(){var a=this.scrollLeft;if(z.headTblCont.scrollLeft=a,!z.isPointerXOverwritten)try{z.Evt.pointerX=function(b){var c=b||global.event,d=tf_StandardBody().scrollLeft+a;return c.pageX+a||c.clientX+d},z.isPointerXOverwritten=!0}catch(b){z.isPointerXOverwritten=!1}}),b.sort!==!1&&(a.sort=!0,a.sortConfig.asyncSort=!0,a.sortConfig.triggerIds=o),this.gridEnableColResizer&&(a.hasExtensions?a._containsStr("colsresizer",Str.lower(a.extensions.src.toString()))||(a.extensions.name.push("ColumnsResizer_"+a.id),a.extensions.src.push(a.gridColResizerPath),a.extensions.description.push("Columns Resizing"),a.extensions.initialize.push(function(a){a.SetColsResizer("ColumnsResizer_"+a.id)})):(a.extensions={name:["ColumnsResizer_"+a.id],src:[this.gridColResizerPath],description:["Columns Resizing"],initialize:[function(a){a.SetColsResizer("ColumnsResizer_"+a.id)}]},a.hasExtensions=!0)),b.col_resizer_cols_headers_table=this.headTbl.getAttribute("id"),b.col_resizer_cols_headers_index=this.gridHeadRowIndex,b.col_resizer_width_adjustment=0,b.col_enable_text_ellipsis=!1,z.tblHasColTag=h.tag(c,"col").length>0?!0:!1;var A=function(b){if(b){for(var d=a.nbCells-1;d>=0;d--){var e=h.create("col",["id",a.id+"_col_"+d]);c.firstChild.parentNode.insertBefore(e,c.firstChild),e.style.width=a.colWidth[d],b.gridColElms[d]=e}b.tblHasColTag=!0}};if(z.tblHasColTag)for(var B=h.tag(c,"col"),C=0;C',this.popUpDivCssClass=c.popup_div_css_class||"popUpFilter",this.onBeforePopUpOpen=h.isFn(c.on_before_popup_filter_open)?c.on_before_popup_filter_open:null,this.onAfterPopUpOpen=h.isFn(c.on_after_popup_filter_open)?c.on_after_popup_filter_open:null,this.onBeforePopUpClose=h.isFn(c.on_before_popup_filter_close)?c.on_before_popup_filter_close:null,this.onAfterPopUpClose=h.isFn(c.on_after_popup_filter_close)?c.on_after_popup_filter_close:null,this.popUpFltSpans=[],this.popUpFltImgs=[],this.popUpFltElms=this.popUpFltElmCache||[],this.popUpFltAdjustToContainer=!0,this.tf=b}return f(a,null,{onClick:{value:function(a){var b=a||global.event,c=b.target.parentNode,d=parseInt(c.getAttribute("ci"),10);if(this.closeAll(d),this.toggle(d),this.popUpFltAdjustToContainer){var e=this.popUpFltElms[d],f=this.tf.getHeaderElement(d),g=.95*f.clientWidth;if(k.isIE()){var h=i.position(f).left;e.style.left=h+"px"}e.style.width=parseInt(g,10)+"px"}j.cancel(b),j.stop(b)},writable:!0,configurable:!0},init:{value:function(){for(var a=this,b=this.tf,c=0;cv;v++)if(a===v&&(!b||b&&e.disableExcludedOptions)||a==v&&b&&(""===l[s].style.display&&!e.paging||e.paging&&(!e.validRowsIndex||e.validRowsIndex&&i.has(e.validRowsIndex,s))&&(void 0===n||n==a||n!=a&&i.has(e.validRowsIndex,s)))){var w=e.getCellData(v,t[v]),x=j.matchCase(w,m);if(i.has(this.opts,x,m)||this.opts.push(w),b&&e.disableExcludedOptions){var y=r[v];y||(y=this.GetFilteredDataCol(v)),!i.has(y,x,m)&&!i.has(q,x,m)&&!this.isFirstLoad&&q.push(w)}}}if(this.isCustom){var z=e.__getCustomValues(a);this.opts=z[0],this.optsTxt=z[1]}if(e.sortSlc&&!this.isCustom&&(m?(this.opts.sort(),q&&q.sort()):(this.opts.sort(k.ignoreCase),q&&q.sort(k.ignoreCase))),e.sortNumAsc&&i.has(e.sortNumAsc,a))try{this.opts.sort(numSortAsc),q&&q.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(A){this.opts.sort(),q&&q.sort(),this.isCustom&&this.optsTxt.sort()}if(e.sortNumDesc&&i.has(e.sortNumDesc,a))try{this.opts.sort(numSortDesc),q&&q.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(A){this.opts.sort(),q&&q.sort(),this.isCustom&&this.optsTxt.sort()}this.addOptions(a,g,b,q,o,p)}},writable:!0,configurable:!0},addOptions:{value:function(a,b,c,d,e,f){var g=this.tf,k=j.lower(this.slcFillingMethod),l=b.value;b.innerHTML="",b=this.addFirstOption(b);for(var m=0;m"+o+""}else{var r;r=g.fillSlcOnDemand&&l===this.opts[m]&&g["col"+a]===g.fltTypeSlc?h.createOpt(o,n,!0):g["col"+a]!==g.fltTypeMulti?h.createOpt(o,n," "!==e[a]&&n===e[a]?!0:!1):h.createOpt(o,n,i.has(f,j.matchCase(this.opts[m],g.matchCase),g.matchCase)||-1!==f.toString().indexOf(n)?!0:!1),p&&(r.disabled=!0),b.appendChild(r)}}"innerhtml"===k&&(b.innerHTML+=this.slcInnerHtml),b.setAttribute("filled","1")},writable:!0,configurable:!0},addFirstOption:{value:function(a){var b=this.tf,c=j.lower(this.slcFillingMethod);if("innerhtml"===c)this.slcInnerHtml+='";else{var d=h.createOpt(this.enableSlcResetFilter?b.displayAllText:"","");if(this.enableSlcResetFilter||(d.style.display="none"),a.appendChild(d),b.enableEmptyOption){var e=h.createOpt(b.emptyText,b.emOperator);a.appendChild(e)}if(b.enableNonEmptyOption){var f=h.createOpt(b.nonEmptyText,b.nmOperator);a.appendChild(f)}}return a},writable:!0,configurable:!0}}),a}()}Object.defineProperty(a,"__esModule",{value:!0})}),define("modules/checkList",["exports","../dom","../array","../string","../sort","../event"],function(a,b,c,d,e,f){{var g=function(a,b,c){b&&Object.defineProperties(a,b),c&&Object.defineProperties(a.prototype,c)},h=function(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")},i=b.Dom,j=c.Arr,k=d.Str,l=e.Sort,m=f.Event;a.CheckList=function(){function a(b){h(this,a);var c=b.config();this.checkListDiv=[],this.checkListDivCssClass=c.div_checklist_css_class||"div_checklist",this.checkListCssClass=c.checklist_css_class||"flt_checklist",this.checkListItemCssClass=c.checklist_item_css_class||"flt_checklist_item",this.checkListSlcItemCssClass=c.checklist_selected_item_css_class||"flt_checklist_slc_item",this.activateCheckListTxt=c.activate_checklist_text||"Click to load filter data",this.checkListItemDisabledCssClass=c.checklist_item_disabled_css_class||"flt_checklist_item_disabled",this.enableCheckListResetFilter=c.enable_checklist_reset_filter===!1?!1:!0,this.isCustom=null,this.opts=null,this.optsTxt=null,this.tf=b}return g(a,null,{onChange:{value:function(a){this.tf.Evt._OnSlcChange(a)},writable:!0,configurable:!0},optionClick:{value:function(a){this.setCheckListValues(a.target),this.onChange(a)},writable:!0,configurable:!0},build:{value:function(a,b,c){var d=this.tf;d.EvtManager(d.Evt.name.checklist,{slcIndex:a,slcExternal:b,slcId:c})},writable:!0,configurable:!0},_build:{value:function(a){var b=this,c=void 0===arguments[1]?!1:arguments[1],d=void 0===arguments[2]?null:arguments[2],e=this.tf;a=parseInt(a,10),this.opts=[],this.optsTxt=[];var f=e.prfxCheckListDiv+a+"_"+e.id;if((i.id(f)||c)&&(i.id(d)||!c)){var g=c?i.id(d):this.checkListDiv[a],h=i.create("ul",["id",e.fltIds[a]],["colIndex",a]);h.className=this.checkListCssClass,m.add(h,"change",function(a){b.onChange(a)});var n=e.tbl.rows;this.isCustom=e.hasCustomSlcOptions&&j.has(e.customSlcOptions.cols,a);var o;e.refreshFilters&&e.activeFilterId&&(o=e.activeFilterId.split("_")[0],o=o.split(e.prfxFlt)[1]);var p,q=[];e.refreshFilters&&e.disableExcludedOptions&&(p=[]);for(var r=e.refRow;ru;u++)if(a===u&&(!e.refreshFilters||e.refreshFilters&&e.disableExcludedOptions)||a===u&&e.refreshFilters&&(""===n[r].style.display&&!e.paging||e.paging&&(!o||o===a||o!=a&&j.has(e.validRowsIndex,r)))){var v=e.getCellData(u,s[u]),w=k.matchCase(v,e.matchCase);j.has(this.opts,w,e.matchCase)||this.opts.push(v);var x=q[u];e.refreshFilters&&e.disableExcludedOptions&&(x||(q[u]=e.GetFilteredDataCol(u)),!j.has(x,w,e.matchCase)&&!j.has(p,w,e.matchCase)&&!e.isFirstLoad&&p.push(v))}}if(this.isCustom){var y=e.__getCustomValues(a);this.opts=y[0],this.optsTxt=y[1] +}if(e.sortSlc&&!this.isCustom&&(e.matchCase?(this.opts.sort(),p&&p.sort()):(this.opts.sort(l.ignoreCase),p&&p.sort(l.ignoreCase))),e.sortNumAsc&&j.has(e.sortNumAsc,a))try{this.opts.sort(numSortAsc),p&&p.sort(numSortAsc),this.isCustom&&this.optsTxt.sort(numSortAsc)}catch(z){this.opts.sort(),p&&p.sort(),this.isCustom&&this.optsTxt.sort()}if(e.sortNumDesc&&j.has(e.sortNumDesc,a))try{this.opts.sort(numSortDesc),p&&p.sort(numSortDesc),this.isCustom&&this.optsTxt.sort(numSortDesc)}catch(z){this.opts.sort(),p&&p.sort(),this.isCustom&&this.optsTxt.sort()}this.addChecks(a,h,e.separator),e.fillSlcOnDemand&&(g.innerHTML=""),g.appendChild(h),g.setAttribute("filled","1")}},writable:!0,configurable:!0},addChecks:{value:function(a,b){var c=this,d=this.tf,e=this.addTChecks(a,b),f=[],g=d.Cpt.store,h=g?g.getFilterValues(d.fltsValuesCookie)[a]:null;h&&k.trim(h).length>0&&(d.hasCustomSlcOptions&&j.has(d.customSlcOptions.cols,a)?f.push(h):f=h.split(" "+d.orOperator+" "));for(var l=0;l0?1:0),f=e+d.pagingLength-1<=b.nbVisibleRows?e+d.pagingLength-1:b.nbVisibleRows;c=e+this.fromToTextSeparator+f+this.overText+b.nbVisibleRows}}else c=a&&""!==a?a:b.nbFilterableRows-b.nbHiddenRows-(b.hasVisibleRows?b.visibleRows.length:0);this.rowsCounterSpan.innerHTML=c,this.onAfterRefreshCounter&&this.onAfterRefreshCounter.call(null,b,this.rowsCounterSpan,c)}},writable:!0,configurable:!0},destroy:{value:function(){var a=this.tf;a.hasGrid()&&this.rowsCounterSpan&&(!this.rowsCounterTgtId&&this.rowsCounterDiv?i.isIE()?this.rowsCounterDiv.outerHTML="":this.rowsCounterDiv.parentNode.removeChild(this.rowsCounterDiv):g.id(this.rowsCounterTgtId).innerHTML="",this.rowsCounterSpan=null,this.rowsCounterDiv=null)},writable:!0,configurable:!0}}),a}()}Object.defineProperty(a,"__esModule",{value:!0})}),define("modules/statusBar",["exports","../dom","../event","../types","../helpers"],function(a,b,c,d,e){{var f=function(a,b,c){b&&Object.defineProperties(a,b),c&&Object.defineProperties(a.prototype,c)},g=function(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")},h=b.Dom,i=(c.Event,d.Types),j=e.Helpers,k=window;a.StatusBar=function(){function a(b){g(this,a);var c=b.config();this.statusBarTgtId=c.status_bar_target_id||null,this.statusBarDiv=null,this.statusBarSpan=null,this.statusBarSpanText=null,this.statusBarText=c.status_bar_text||"",this.statusBarCssClass=c.status_bar_css_class||"status",this.statusBarCloseDelay=250,this.onBeforeShowMsg=i.isFn(c.on_before_show_msg)?c.on_before_show_msg:null,this.onAfterShowMsg=i.isFn(c.on_after_show_msg)?c.on_after_show_msg:null,this.tf=b}return f(a,null,{init:{value:function(){var a=this.tf;if(a.hasGrid()||a.isFirstLoad){var b=h.create("div",["id",a.prfxStatus+a.id]);b.className=this.statusBarCssClass;var c=h.create("span",["id",a.prfxStatusSpan+a.id]),d=h.create("span",["id",a.prfxStatusTxt+a.id]);d.appendChild(h.text(this.statusBarText)),this.statusBarTgtId||a.setToolbar();var e=this.statusBarTgtId?h.id(this.statusBarTgtId):a.lDiv;this.statusBarDiv&&j.isIE()&&(this.statusBarDiv.outerHTML=""),this.statusBarTgtId?(e.appendChild(d),e.appendChild(c)):(b.appendChild(d),b.appendChild(c),e.appendChild(b)),this.statusBarDiv=b,this.statusBarSpan=c,this.statusBarSpanText=d}},writable:!0,configurable:!0},message:{value:function(){var a=this,b=void 0===arguments[0]?"":arguments[0],c=this.tf;if(c.statusBar&&this.statusBarSpan){this.onBeforeShowMsg&&this.onBeforeShowMsg.call(null,this.tf,b);var d=""===b?this.statusBarCloseDelay:1;k.setTimeout(function(){a.statusBarSpan.innerHTML=b,a.onAfterShowMsg&&a.onAfterShowMsg.call(null,a.tf,b)},d)}},writable:!0,configurable:!0},destroy:{value:function(){var a=this.tf;a.hasGrid()&&this.statusBarDiv&&(this.statusBarDiv.innerHTML="",this.statusBarDiv.parentNode.removeChild(this.statusBarDiv),this.statusBarSpan=null,this.statusBarSpanText=null,this.statusBarDiv=null)},writable:!0,configurable:!0}}),a}()}Object.defineProperty(a,"__esModule",{value:!0})}),define("modules/paging",["exports","../dom","../types","../string","../helpers","../event"],function(a,b,c,d,e,f){{var g=function(a,b,c){b&&Object.defineProperties(a,b),c&&Object.defineProperties(a.prototype,c)},h=function(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")},i=b.Dom,j=c.Types,k=d.Str,l=(e.Helpers,f.Event);a.Paging=function(){function a(b){h(this,a);var c=b.config();this.btnPageCssClass=c.paging_btn_css_class||"pgInp",this.pagingSlc=null,this.resultsPerPageSlc=null,this.pagingTgtId=c.paging_target_id||null,this.pagingLength=isNaN(c.paging_length)?10:c.paging_length,this.resultsPerPageTgtId=c.results_per_page_target_id||null,this.pgSlcCssClass=c.paging_slc_css_class||"pgSlc",this.pgInpCssClass=c.paging_inp_css_class||"pgNbInp",this.resultsPerPage=c.results_per_page||null,this.hasResultsPerPage=j.isArray(this.resultsPerPage),this.resultsSlcCssClass=c.results_slc_css_class||"rspg",this.resultsSpanCssClass=c.results_span_css_class||"rspgSpan",this.startPagingRow=0,this.nbPages=0,this.currentPageNb=1,this.btnNextPageText=c.btn_next_page_text||">",this.btnPrevPageText=c.btn_prev_page_text||"<",this.btnLastPageText=c.btn_last_page_text||">|",this.btnFirstPageText=c.btn_first_page_text||"|<",this.btnNextPageHtml=c.btn_next_page_html||(b.enableIcons?'':null),this.btnPrevPageHtml=c.btn_prev_page_html||(b.enableIcons?'':null),this.btnFirstPageHtml=c.btn_first_page_html||(b.enableIcons?'':null),this.btnLastPageHtml=c.btn_last_page_html||(b.enableIcons?'':null),this.pageText=c.page_text||" Page ",this.ofText=c.of_text||" of ",this.nbPgSpanCssClass=c.nb_pages_css_class||"nbpg",this.hasPagingBtns=c.paging_btns===!1?!1:!0,this.pageSelectorType=c.page_selector_type||b.fltTypeSlc,this.onBeforeChangePage=j.isFn(c.on_before_change_page)?c.on_before_change_page:null,this.onAfterChangePage=j.isFn(c.on_after_change_page)?c.on_after_change_page:null;var d=this.refRow,e=this.nbRows;this.nbPages=Math.ceil((e-d)/this.pagingLength);var f=this;this.evt={slcIndex:function(){return f.pageSelectorType===b.fltTypeSlc?f.pagingSlc.options.selectedIndex:parseInt(f.pagingSlc.value,10)-1},nbOpts:function(){return f.pageSelectorType===b.fltTypeSlc?parseInt(f.pagingSlc.options.length,10)-1:f.nbPages-1},next:function(){var a=f.evt.slcIndex()0?f.evt.slcIndex()-1:f.evt.nbOpts();f.changePage(a)},last:function(){f.changePage(f.evt.nbOpts())},first:function(){f.changePage(0)},_detectKey:function(a){var c=b.Evt.getKeyCode(a);13===c&&(b.sorted?(b.filter(),f.changePage(f.evt.slcIndex())):f.changePage(),this.blur())},slcPagesChange:null,nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null},this.tf=b}return g(a,null,{init:{value:function(){var a,b=this,c=this.tf,d=this.evt;this.hasResultsPerPage&&(this.resultsPerPage.length<2?this.hasResultsPerPage=!1:(this.pagingLength=this.resultsPerPage[1][0],this.setResultsPerPage())),d.slcPagesChange=function(a){b.changePage(),a.target.blur()},this.pageSelectorType===c.fltTypeSlc&&(a=i.create(c.fltTypeSlc,["id",c.prfxSlcPages+c.id]),a.className=this.pgSlcCssClass,l.add(a,"change",d.slcPagesChange)),this.pageSelectorType===c.fltTypeInp&&(a=i.create(c.fltTypeInp,["id",c.prfxSlcPages+c.id],["value",this.currentPageNb]),a.className=this.pgInpCssClass,l.add(a,"keypress",d._detectKey));var e=i.create("span",["id",c.prfxBtnNextSpan+c.id]),f=i.create("span",["id",c.prfxBtnPrevSpan+c.id]),g=i.create("span",["id",c.prfxBtnLastSpan+c.id]),h=i.create("span",["id",c.prfxBtnFirstSpan+c.id]);if(this.hasPagingBtns){if(this.btnNextPageHtml)e.innerHTML=this.btnNextPageHtml,l.add(e,"click",d.next);else{var j=i.create(c.fltTypeInp,["id",c.prfxBtnNext+c.id],["type","button"],["value",this.btnNextPageText],["title","Next"]);j.className=this.btnPageCssClass,l.add(j,"click",d.next),e.appendChild(j)}if(this.btnPrevPageHtml)f.innerHTML=this.btnPrevPageHtml,l.add(f,"click",d.prev);else{var k=i.create(c.fltTypeInp,["id",c.prfxBtnPrev+c.id],["type","button"],["value",this.btnPrevPageText],["title","Previous"]);k.className=this.btnPageCssClass,l.add(k,"click",d.prev),f.appendChild(k)}if(this.btnLastPageHtml)g.innerHTML=this.btnLastPageHtml,l.add(g,"click",d.last);else{var m=i.create(c.fltTypeInp,["id",c.prfxBtnLast+c.id],["type","button"],["value",this.btnLastPageText],["title","Last"]);m.className=this.btnPageCssClass,l.add(m,"click",d.last),g.appendChild(m)}if(this.btnFirstPageHtml)h.innerHTML=this.btnFirstPageHtml,l.add(h,"click",d.first);else{var n=i.create(c.fltTypeInp,["id",c.prfxBtnFirst+c.id],["type","button"],["value",this.btnFirstPageText],["title","First"]);n.className=this.btnPageCssClass,l.add(n,"click",d.first),h.appendChild(n)}}this.pagingTgtId||c.setToolbar();var o=this.pagingTgtId?i.id(this.pagingTgtId):c.mDiv;o.appendChild(h),o.appendChild(f);var p=i.create("span",["id",c.prfxPgBeforeSpan+c.id]);p.appendChild(i.text(this.pageText)),p.className=this.nbPgSpanCssClass,o.appendChild(p),o.appendChild(a);var q=i.create("span",["id",c.prfxPgAfterSpan+c.id]);q.appendChild(i.text(this.ofText)),q.className=this.nbPgSpanCssClass,o.appendChild(q);var r=i.create("span",["id",c.prfxPgSpan+c.id]);r.className=this.nbPgSpanCssClass,r.appendChild(i.text(" "+this.nbPages+" ")),o.appendChild(r),o.appendChild(e),o.appendChild(g),this.pagingSlc=i.id(c.prfxSlcPages+c.id),(!c.rememberGridValues||this.isPagingRemoved)&&this.setPagingInfo(),c.fltGrid||(c.ValidateAllRows(),this.setPagingInfo(c.validRowsIndex)),this.isPagingRemoved=!1},writable:!0,configurable:!0},addPaging:{value:function(){var a=void 0===arguments[0]?!1:arguments[0],b=this.tf;b.hasGrid()&&!b.paging&&(b.paging=!0,this.isPagingRemoved=!0,this.init(),b.resetValues(),a&&b.filter())},writable:!0,configurable:!0},setPagingInfo:{value:function(a){var b=this.tf,c=b.tbl.rows,d=this.pagingTgtId?i.id(this.pagingTgtId):b.mDiv,e=i.id(b.prfxPgSpan+b.id);if(a&&a.length>0)b.validRowsIndex=a;else{b.validRowsIndex=[];for(var f=b.refRow;f0)if(d.style.visibility="visible",this.pageSelectorType===b.fltTypeSlc)for(var j=0;j=this.startPagingRow&&d>e?("true"!==f.getAttribute("validRow")&&f.getAttribute("validRow")||(f.style.display=""),b.alternateBgs&&b.Cpt.alternateRows&&b.Cpt.alternateRows.setRowBg(b.validRowsIndex[e],e)):(f.style.display="none",b.alternateBgs&&b.Cpt.alternateRows&&b.Cpt.alternateRows.removeRowBg(b.validRowsIndex[e]))}b.nbVisibleRows=b.validRowsIndex.length,b.isStartBgAlternate=!1,b.applyGridProps()},writable:!0,configurable:!0},setPage:{value:function(a){var b=this.tf;if(b.hasGrid()&&this.paging){var c=this.evt,d=typeof a;if("string"===d)switch(k.lower(a)){case"next":c.next();break;case"previous":c.prev();break;case"last":c.last();break;case"first":c.first();break;default:c.next()}else"number"===d&&this.changePage(a-1)}},writable:!0,configurable:!0},setResultsPerPage:{value:function(){var a=this,b=this.tf,c=this.evt;if((b.hasGrid()||b.isFirstLoad)&&!this.resultsPerPageSlc&&this.resultsPerPage){c.slcResultsChange=function(b){a.changeResultsPerPage(),b.target.blur()};var d=i.create(b.fltTypeSlc,["id",b.prfxSlcResults+b.id]);d.className=b.resultsSlcCssClass;var e=this.resultsPerPage[0],f=this.resultsPerPage[1],g=i.create("span",["id",b.prfxSlcResultsTxt+b.id]);g.className=this.resultsSpanCssClass,this.resultsPerPageTgtId||b.setToolbar();var h=this.resultsPerPageTgtId?i.id(this.resultsPerPageTgtId):b.rDiv;g.appendChild(i.text(e)),h.appendChild(g),h.appendChild(d),this.resultsPerPageSlc=i.id(b.prfxSlcResults+b.id);for(var j=0;j=0&&a<=this.nbPages-1&&(this.onBeforeChangePage&&this.onBeforeChangePage.call(null,this,a),this.currentPageNb=parseInt(a,10)+1,this.pageSelectorType===b.fltTypeSlc?this.pagingSlc.options[a].selected=!0:this.pagingSlc.value=this.currentPageNb,b.rememberPageNb&&b.Cpt.store.savePageNb(b.pgNbCookie),this.startPagingRow=this.pageSelectorType===b.fltTypeSlc?this.pagingSlc.value:a*this.pagingLength,this.groupByPage(),this.onAfterChangePage&&this.onAfterChangePage.call(null,this,a)))},writable:!0,configurable:!0},_changeResultsPerPage:{value:function(){var a=this.tf;if(a.paging){var b=this.resultsPerPageSlc,c=this.pageSelectorType===a.fltTypeSlc?this.pagingSlc.selectedIndex:parseInt(this.pagingSlc.value-1,10);if(this.pagingLength=parseInt(b.options[b.selectedIndex].value,10),this.startPagingRow=this.pagingLength*c,!isNaN(this.pagingLength)){if(this.startPagingRow>=a.nbFilterableRows&&(this.startPagingRow=a.nbFilterableRows-this.pagingLength),this.setPagingInfo(),this.pageSelectorType===a.fltTypeSlc){var d=this.pagingSlc.options.length-1<=c?this.pagingSlc.options.length-1:c;this.pagingSlc.options[d].selected=!0}a.rememberPageLen&&a.Cpt.store.savePageLength(a.pgLenCookie)}}},writable:!0,configurable:!0},_resetPage:{value:function(a){var b=this.tf,c=b.Cpt.store.getPageNb(a);""!==c&&this.changePage(c-1)},writable:!0,configurable:!0},_resetPageLength:{value:function(a){var b=this.tf;if(b.paging){var c=b.Cpt.store.getPageLength(a);""!==c&&(this.resultsPerPageSlc.options[c].selected=!0,this.changeResultsPerPage())}},writable:!0,configurable:!0},destroy:{value:function(){var a=this.tf;if(a.hasGrid()){var b,c,d,e,f,g,h;b=i.id(a.prfxBtnNextSpan+a.id),c=i.id(a.prfxBtnPrevSpan+a.id),d=i.id(a.prfxBtnLastSpan+a.id),e=i.id(a.prfxBtnFirstSpan+a.id),f=i.id(a.prfxPgBeforeSpan+a.id),g=i.id(a.prfxPgAfterSpan+a.id),h=i.id(a.prfxPgSpan+a.id);var j=this.evt;this.pagingSlc&&(this.pageSelectorType===a.fltTypeSlc?l.remove(this.pagingSlc,"change",j.slcPagesChange):this.pageSelectorType===a.fltTypeInp&&l.remove(this.pagingSlc,"keypress",j._detectKey),this.pagingSlc.parentNode.removeChild(this.pagingSlc)),b&&(l.remove(b,"click",j.next),b.parentNode.removeChild(b)),c&&(l.remove(c,"click",j.prev),c.parentNode.removeChild(c)),d&&(l.remove(d,"click",j.last),d.parentNode.removeChild(d)),e&&(l.remove(e,"click",j.first),e.parentNode.removeChild(e)),f&&f.parentNode.removeChild(f),g&&g.parentNode.removeChild(g),h&&h.parentNode.removeChild(h),this.hasResultsPerPage&&this.removeResultsPerPage(),this.pagingSlc=null,this.nbPages=0,this.isPagingRemoved=!0,a.paging=!1}},writable:!0,configurable:!0}}),a}()}Object.defineProperty(a,"__esModule",{value:!0})}),define("modules/clearButton",["exports","../dom","../event"],function(a,b,c){{var d=function(a,b,c){b&&Object.defineProperties(a,b),c&&Object.defineProperties(a.prototype,c)},e=function(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")},f=b.Dom,g=c.Event;a.ClearButton=function(){function a(b){e(this,a);var c=b.config();this.btnResetTgtId=c.btn_reset_target_id||null,this.btnResetEl=null,this.btnResetText=c.btn_reset_text||"Reset",this.btnResetTooltip=c.btn_reset_tooltip||"Clear filters",this.btnResetHtml=c.btn_reset_html||(b.enableIcons?'':null),this.tf=b}return d(a,null,{onClick:{value:function(){this.tf.clearFilters()},writable:!0,configurable:!0},init:{value:function(){var a=this,b=this.tf;if(b.hasGrid()||b.isFirstLoad||!b.btnResetEl){var c=f.create("span",["id",b.prfxResetSpan+b.id]);this.btnResetTgtId||b.setToolbar();var d=this.btnResetTgtId?f.id(this.btnResetTgtId):b.rDiv;if(d.appendChild(c),this.btnResetHtml){c.innerHTML=this.btnResetHtml;var e=c.firstChild;g.add(e,"click",function(){a.onClick()})}else{var h=f.create("a",["href","javascript:void(0);"]);h.className=b.btnResetCssClass,h.appendChild(f.text(this.btnResetText)),c.appendChild(h),g.add(h,"click",function(){a.onClick()})}this.btnResetEl=c.firstChild}},writable:!0,configurable:!0},destroy:{value:function(){var a=this.tf;if(a.hasGrid()&&this.btnResetEl){var b=f.id(a.prfxResetSpan+a.id);b&&b.parentNode.removeChild(b),this.btnResetEl=null}},writable:!0,configurable:!0}}),a}()}Object.defineProperty(a,"__esModule",{value:!0})}),define("modules/help",["exports","../dom","../event"],function(a,b,c){{var d=function(a,b,c){b&&Object.defineProperties(a,b),c&&Object.defineProperties(a.prototype,c)},e=function(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")},f=b.Dom,g=c.Event;a.Help=function(){function a(b){e(this,a);var c=b.config();this.helpInstrTgtId=c.help_instructions_target_id||null,this.helpInstrContTgtId=c.help_instructions_container_target_id||null,this.helpInstrText=c.help_instructions_text?c.help_instructions_text:'Use the filters above each column to filter and limit table data. Avanced searches can be performed by using the following operators:
<, <=, >, >=, =, *, !, {, }, ||,&&, [empty], [nonempty], rgx:
These operators are described here:
http://tablefilter.free.fr/#operators
',this.helpInstrHtml=c.help_instructions_html||null,this.helpInstrBtnText=c.help_instructions_btn_text||"?",this.helpInstrBtnHtml=c.help_instructions_btn_html||null,this.helpInstrBtnCssClass=c.help_instructions_btn_css_class||"helpBtn",this.helpInstrContCssClass=c.help_instructions_container_css_class||"helpCont",this.helpInstrBtnEl=null,this.helpInstrContEl=null,this.helpInstrDefaultHtml='

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

http://tablefilter.free.fr
©2009-'+b.year+' Max Guglielmi.
',this.tf=b}return d(a,null,{init:{value:function(){var a=this;if(!this.helpInstrBtnEl){var b=this.tf,c=f.create("span",["id",b.prfxHelpSpan+b.id]),d=f.create("div",["id",b.prfxHelpDiv+b.id]);this.helpInstrTgtId||b.setToolbar();var e=this.helpInstrTgtId?f.id(this.helpInstrTgtId):b.rDiv;e.appendChild(c);var h=this.helpInstrContTgtId?f.id(this.helpInstrContTgtId):c;if(this.helpInstrBtnHtml){c.innerHTML=this.helpInstrBtnHtml;var i=c.firstChild;g.add(i,"click",function(){a.toggle()}),h.appendChild(d)}else{h.appendChild(d);var j=f.create("a",["href","javascript:void(0);"]);j.className=this.helpInstrBtnCssClass,j.appendChild(f.text(this.helpInstrBtnText)),c.appendChild(j),g.add(j,"click",function(){a.toggle()})}this.helpInstrHtml?(this.helpInstrContTgtId&&h.appendChild(d),d.innerHTML=this.helpInstrHtml,this.helpInstrContTgtId||(d.className=this.helpInstrContCssClass,g.add(d,"dblclick",function(){a.toggle()}))):(d.innerHTML=this.helpInstrText,d.className=this.helpInstrContCssClass,g.add(d,"dblclick",function(){a.toggle()})),d.innerHTML+=this.helpInstrDefaultHtml,g.add(d,"click",function(){a.toggle()}),this.helpInstrContEl=d,this.helpInstrBtnEl=c}},writable:!0,configurable:!0},toggle:{value:function(){if(this.helpInstrContEl){var a=this.helpInstrContEl.style.display;if(""===a||"none"===a){this.helpInstrContEl.style.display="block";var b=f.position(this.helpInstrBtnEl).left;this.helpInstrContTgtId||(this.helpInstrContEl.style.left=b-this.helpInstrContEl.clientWidth+25+"px")}else this.helpInstrContEl.style.display="none"}},writable:!0,configurable:!0},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))},writable:!0,configurable:!0}}),a}()}Object.defineProperty(a,"__esModule",{value:!0})}),define("modules/alternateRows",["exports","../dom"],function(a,b){{var c=function(a,b,c){b&&Object.defineProperties(a,b),c&&Object.defineProperties(a.prototype,c)},d=function(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")},e=b.Dom;a.AlternateRows=function(){function a(b){d(this,a);var c=b.config();this.evenCss=c.even_row_css_class||"even",this.oddCss=c.odd_row_css_class||"odd",this.tf=b}return c(a,null,{init:{value:function(){if(this.tf.hasGrid()||this.tf.isFirstLoad)for(var a=(this.tf.tbl.rows,null===this.tf.validRowsIndex),b=a?this.tf.refRow:0,c=a?this.tf.nbFilterableRows+b:this.tf.validRowsIndex.length,d=0,e=b;c>e;e++){var f=a?e:this.tf.validRowsIndex[e];this.setRowBg(f,d),d++}},writable:!0,configurable:!0},setRowBg:{value:function(a,b){if(this.tf.alternateBgs&&!isNaN(a)){var c=this.tf.tbl.rows,d=b?b:a;this.removeRowBg(a),e.addClass(c[a],d%2?this.evenCss:this.oddCss)}},writable:!0,configurable:!0},removeRowBg:{value:function(a){if(!isNaN(a)){var b=this.tf.tbl.rows;e.removeClass(b[a],this.oddCss),e.removeClass(b[a],this.evenCss)}},writable:!0,configurable:!0},remove:{value:function(){if(this.tf.hasGrid()){for(var a=(this.tf.tbl.rows,this.tf.refRow);a=jj;jj++)ucolIndex[jj]===colIndex[ii]&&(saved=1);0===saved&&(ucolMax++,ucolIndex[ucolMax]=colIndex[ii])}if("object"==Str.lower(typeof labelId)&&"object"==Str.lower(typeof colIndex)&&"object"==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.id(labThisCol[i]))switch(Str.lower(oTypeThisCol)){case"innerhtml":Dom.id(labThisCol[i]).innerHTML=isNaN(result)||!isFinite(result)||0===nbvalues?".":result;break;case"setvalue":Dom.id(labThisCol[i]).value=result;break;case"createtextnode":var oldnode=Dom.id(labThisCol[i]).firstChild,txtnode=Dom.text(result);Dom.id(labThisCol[i]).replaceChild(txtnode,oldnode)}}else try{Dom.id(labThisCol[i]).innerHTML=isNaN(result)||!isFinite(result)||0===nbvalues?".":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)}},writable:!0,configurable:!0}}),ColOps}();Object.defineProperty(exports,"__esModule",{value:!0})}),define("core",["exports","module","event","dom","string","cookie","types","array","helpers","date","sort","modules/store","modules/gridLayout","modules/loader","modules/highlightKeywords","modules/popupFilter","modules/dropdown","modules/checkList","modules/rowsCounter","modules/statusBar","modules/paging","modules/clearButton","modules/help","modules/alternateRows","modules/colOps"],function(a,b,c,d,e,f,g,h,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A){function B(a,b){if(a){b||(b="us");var c=a;return c="us"===H.lower(b)?+c.replace(/[^\d\.-]/g,""):+c.replace(/[^\d\,-]/g,"").replace(",",".")}}function C(){if(bb.body.__defineGetter__&&HTMLElement){var a=HTMLElement.prototype;a.__defineGetter__&&a.__defineGetter__("outerHTML",function(){var a=this.parentNode,b=G.create(a.tagName);b.appendChild(this);var c=b.innerHTML;return a.appendChild(this),c}),a.__defineSetter__&&HTMLElement.prototype.__defineSetter__("outerHTML",function(a){var b=this.ownerDocument.createRange();b.setStartBefore(this);var c=b.createContextualFragment(a);return this.parentNode.replaceChild(c,this),a})}}var D=function(a,b,c){b&&Object.defineProperties(a,b),c&&Object.defineProperties(a.prototype,c)},E=function(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")},F=c.Event,G=d.Dom,H=e.Str,I=f.Cookie,J=g.Types,K=h.Arr,L=(k.Helpers,l.DateHelper),M=(m.Sort,n.Store),N=o.GridLayout,O=p.Loader,P=q.HighlightKeyword,Q=r.PopupFilter,R=s.Dropdown,S=t.CheckList,T=u.RowsCounter,U=v.StatusBar,V=w.Paging,W=x.ClearButton,X=y.Help,Y=z.AlternateRows,Z=A.ColOps,$=window,_=L.isValid,ab=L.format,bb=$.document,cb=function(){function a(b){if(E(this,a),0!==arguments.length){if(this.id=b,this.version="3.0",this.year=(new Date).getFullYear(),this.tbl=G.id(b),this.startRow=null,this.refRow=null,this.headersRow=null,this.cfg={},this.nbFilterableRows=null,this.nbRows=null,this.nbCells=null,this._hasGrid=!1,this.enableModules=!1,!this.tbl||"table"!==H.lower(this.tbl.nodeName)||0===this.getRowsNb())throw new Error("Could not instantiate TF object: HTML table not found.");if(arguments.length>1)for(var c=0;c1?this.filtersRowIndex=this.headersRow+1:(this.filtersRowIndex=1,this.headersRow=0)),this.fltCellTag="th"!==f.filters_cell_tag||"td"!==f.filters_cell_tag?"td":f.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=f.inf_div_css_class||"inf",this.lDivCssClass=f.left_div_css_class||"ldiv",this.rDivCssClass=f.right_div_css_class||"rdiv",this.mDivCssClass=f.middle_div_css_class||"mdiv",this.contDivCssClass=f.content_div_css_class||"cont",this.stylesheet=f.stylesheet||this.basePath+"filtergrid.css",this.stylesheetId=this.id+"_style",this.fltsRowCssClass=f.flts_row_css_class||"fltrow",this.enableIcons=f.enable_icons===!1?!1:!0,this.alternateBgs=f.alternate_rows===!0?!0:!1,this.hasColWidth=f.col_width===!0?!0:!1,this.colWidth=this.hasColWidth?f.col_width:null,this.fixedHeaders=f.fixed_headers===!0?!0:!1,this.tBodyH=isNaN(f.tbody_height)?200:f.tbody_height,this.fltCssClass=f.flt_css_class||"flt",this.fltMultiCssClass=f.flt_multi_css_class||"flt_multi",this.fltSmallCssClass=f.flt_small_css_class||"flt_s",this.singleFltCssClass=f.single_flt_css_class||"single_flt",this.isStartBgAlternate=!0,this.enterKey=f.enter_key===!1?!1:!0,this.isModFilterFn=f.mod_filter_fn===!0?!0:!1,this.modFilterFn=this.isModFilterFn?f.mod_filter_fn:null,this.onBeforeFilter=J.isFn(f.on_before_filter)?f.on_before_filter:null,this.onAfterFilter=J.isFn(f.on_after_filter)?f.on_after_filter:null,this.matchCase=f.match_case===!0?!0:!1,this.exactMatch=f.exact_match===!0?!0:!1,this.linkedFilters=f.linked_filters===!0?!0:!1,this.disableExcludedOptions=f.disable_excluded_options===!0?!0:!1,this.activeFlt=null,this.activeFilterId=null,this.hasColOperation=f.col_operation?!0:!1,this.colOperation=null,this.hasVisibleRows=f.rows_always_visible?!0:!1,this.visibleRows=this.hasVisibleRows?f.rows_always_visible:[],this.searchType=f.search_type||"include",this.isExternalFlt=f.external_flt_grid===!0?!0:!1,this.externalFltTgtIds=f.external_flt_grid_ids||null,this.externalFltEls=[],this.execDelay=isNaN(f.exec_delay)?100:parseInt(f.exec_delay,10),this.onFiltersLoaded=J.isFn(f.on_filters_loaded)?f.on_filters_loaded:null,this.singleSearchFlt=f.single_search_filter===!0?!0:!1,this.onRowValidated=J.isFn(f.on_row_validated)?f.on_row_validated:null,this.customCellDataCols=f.custom_cell_data_cols?f.custom_cell_data_cols:[],this.customCellData=J.isFn(f.custom_cell_data)?f.custom_cell_data:null,this.watermark=f.watermark||"",this.isWatermarkArray=J.isArray(this.watermark),this.toolBarTgtId=f.toolbar_target_id||null,this.helpInstructions=f.help_instructions||!1,this.popUpFilters=f.popup_filters===!0?!0:!1,this.markActiveColumns=f.mark_active_columns===!0?!0:!1,this.activeColumnsCssClass=f.active_columns_css_class||"activeHeader",this.onBeforeActiveColumn=J.isFn(f.on_before_active_column)?f.on_before_active_column:null,this.onAfterActiveColumn=J.isFn(f.on_after_active_column)?f.on_after_active_column:null,this.displayAllText=f.display_all_text||"",this.enableEmptyOption=f.enable_empty_option===!0?!0:!1,this.emptyText=f.empty_text||"(Empty)",this.enableNonEmptyOption=f.enable_non_empty_option===!0?!0:!1,this.nonEmptyText=f.non_empty_text||"(Non empty)",this.onSlcChange=f.on_change===!1?!1:!0,this.sortSlc=f.sort_select===!1?!1:!0,this.isSortNumAsc=f.sort_num_asc===!0?!0:!1,this.sortNumAsc=this.isSortNumAsc?f.sort_num_asc:null,this.isSortNumDesc=f.sort_num_desc===!0?!0:!1,this.sortNumDesc=this.isSortNumDesc?f.sort_num_desc:null,this.fillSlcOnDemand=f.fill_slc_on_demand===!0?!0:!1,this.hasCustomSlcOptions=J.isObj(f.custom_slc_options)?!0:!1,this.customSlcOptions=J.isArray(f.custom_slc_options)?f.custom_slc_options:null,this.rgxOperator=f.regexp_operator||"rgx:",this.emOperator=f.empty_operator||"[empty]",this.nmOperator=f.nonempty_operator||"[nonempty]",this.orOperator=f.or_operator||"||",this.anOperator=f.and_operator||"&&",this.grOperator=f.greater_operator||">",this.lwOperator=f.lower_operator||"<",this.leOperator=f.lower_equal_operator||"<=",this.geOperator=f.greater_equal_operator||">=",this.dfOperator=f.different_operator||"!",this.lkOperator=f.like_operator||"*",this.eqOperator=f.equal_operator||"=",this.stOperator=f.start_with_operator||"{",this.enOperator=f.end_with_operator||"}",this.curExp=f.cur_exp||"^[¥£€$]",this.separator=f.separator||",",this.rowsCounter=f.rows_counter===!0?!0:!1,this.statusBar=f.status_bar===!0?!0:!1,this.loader=f.loader===!0?!0:!1,this.displayBtn=f.btn===!0?!0:!1,this.btnText=f.btn_text||(this.enableIcons?"":"Go"),this.btnCssClass=f.btn_css_class||(this.enableIcons?"btnflt_icon":"btnflt"),this.btnReset=f.btn_reset===!0?!0:!1,this.btnResetCssClass=f.btn_reset_css_class||"reset",this.onBeforeReset=J.isFn(f.on_before_reset)?f.on_before_reset:null,this.onAfterReset=J.isFn(f.on_after_reset)?f.on_after_reset:null,this.paging=f.paging===!0?!0:!1,this.nbVisibleRows=0,this.nbHiddenRows=0,this.sort=f.sort===!0?!0:!1,this.isSortEnabled=!1,this.sorted=!1,this.sortConfig=f.sort_config||{},this.sortConfig.name=void 0!==this.sortConfig.name?f.sort_config.name:"sortabletable",this.sortConfig.src=void 0!==this.sortConfig.src?f.sort_config.src:this.basePath+"sortabletable.js",this.sortConfig.adapterSrc=void 0!==this.sortConfig.adapter_src?f.sort_config.adapter_src:this.basePath+"tfAdapter.sortabletable.js",this.sortConfig.initialize=void 0!==this.sortConfig.initialize?f.sort_config.initialize:function(a){a.SetSortTable&&a.SetSortTable()},this.sortConfig.sortTypes=J.isArray(this.sortConfig.sort_types)?f.sort_config.sort_types:[],this.sortConfig.sortCol=void 0!==this.sortConfig.sort_col?f.sort_config.sort_col:null,this.sortConfig.asyncSort=this.sortConfig.async_sort===!0?!0:!1,this.sortConfig.triggerIds=J.isArray(this.sortConfig.sort_trigger_ids)?f.sort_config.sort_trigger_ids:[],this.selectable=f.selectable===!0?!0:!1,this.editable=f.editable===!0?!0:!1,this.ezEditTableConfig=f.ezEditTable_config||{},this.ezEditTableConfig.name=void 0!==this.ezEditTableConfig.name?f.ezEditTable_config.name:"ezedittable",this.ezEditTableConfig.src=void 0!==this.ezEditTableConfig.src?f.ezEditTable_config.src:this.basePath+"ezEditTable/ezEditTable.js",this.ezEditTableConfig.loadStylesheet=this.ezEditTableConfig.loadStylesheet===!0?!0:!1,this.ezEditTableConfig.stylesheet=this.ezEditTableConfig.stylesheet||this.basePath+"ezEditTable/ezEditTable.css",this.ezEditTableConfig.stylesheetName=void 0!==this.ezEditTableConfig.stylesheetName?f.ezEditTable_config.stylesheetName:"ezEditTableCss",this.ezEditTableConfig.err='Failed to instantiate EditTable object.\n"ezEditTable" module may not be available.',this.onKeyUp=f.on_keyup===!0?!0:!1,this.onKeyUpDelay=isNaN(f.on_keyup_delay)?900:f.on_keyup_delay,this.isUserTyping=null,this.onKeyUpTimer=void 0,this.highlightKeywords=f.highlight_keywords===!0?!0:!1,this.defaultDateType=f.default_date_type||"DMY",this.thousandsSeparator=f.thousands_separator||",",this.decimalSeparator=f.decimal_separator||".",this.hasColNbFormat=f.col_number_format===!0?!0:!1,this.colNbFormat=J.isArray(this.hasColNbFormat)?f.col_number_format:null,this.hasColDateType=f.col_date_type===!0?!0:!1,this.colDateType=J.isArray(this.hasColDateType)?f.col_date_type:null,this.msgFilter=f.msg_filter||"Filtering data...",this.msgPopulate=f.msg_populate||"Populating filter...",this.msgPopulateCheckList=f.msg_populate_checklist||"Populating list...",this.msgChangePage=f.msg_change_page||"Collecting paging data...",this.msgClear=f.msg_clear||"Clearing filters...",this.msgChangeResults=f.msg_change_results||"Changing results per page...",this.msgResetValues=f.msg_reset_grid_values||"Re-setting filters values...",this.msgResetPage=f.msg_reset_page||"Re-setting page...",this.msgResetPageLength=f.msg_reset_page_length||"Re-setting page length...",this.msgSort=f.msg_sort||"Sorting data...",this.msgLoadExtensions=f.msg_load_extensions||"Loading extensions...",this.msgLoadThemes=f.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.prfxContentDiv="cont_",this.prfxCheckListDiv="chkdiv_",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_",this.prfxCounter="counter_",this.prfxTotRows="totrows_span_",this.prfxTotRowsTxt="totRowsTextSpan_",this.prfxResetSpan="resetspan_",this.prfxLoader="load_",this.prfxStatus="status_",this.prfxStatusSpan="statusSpan_",this.prfxStatusTxt="statusText_",this.prfxCookieFltsValues="tf_flts_",this.prfxCookiePageNb="tf_pgnb_",this.prfxCookiePageLen="tf_pglen_",this.prfxMainTblCont="gridCont_",this.prfxTblCont="tblCont_",this.prfxHeadTblCont="tblHeadCont_",this.prfxHeadTbl="tblHead_",this.prfxGridFltTd="_td_",this.prfxGridTh="tblHeadTh_",this.prfxHelpSpan="helpSpan_",this.prfxHelpDiv="helpDiv_",this.prfxPopUpSpan="popUpSpan_",this.prfxPopUpDiv="popUpDiv_",this.hasStoredValues=!1,this.rememberGridValues=f.remember_grid_values===!0?!0:!1,this.fltsValuesCookie=this.prfxCookieFltsValues+this.id,this.rememberPageNb=this.paging&&f.remember_page_number?!0:!1,this.pgNbCookie=this.prfxCookiePageNb+this.id,this.rememberPageLen=this.paging&&f.remember_page_length?!0:!1,this.pgLenCookie=this.prfxCookiePageLen+this.id,this.hasExtensions=f.extensions===!0?!0:!1,this.extensions=this.hasExtensions?f.extensions:null,this.enableDefaultTheme=f.enable_default_theme===!0?!0:!1,this.hasThemes=f.enable_default_theme||f.themes&&J.isObj(f.themes)?!0:!1,this.themes=this.hasThemes?f.themes:null,this.themesPath=f.themes_path||this.basePath+"TF_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};var k=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"},getKeyCode:function(a){return a.charCode?a.charCode:a.keyCode?a.keyCode:a.which?a.which:0},_DetectKey:function(a){if(k.enterKey){var b=a||$.event;if(b){var c=k.Evt.getKeyCode(b);13===c?(k._filter(),F.cancel(b),F.stop(b)):(k.isUserTyping=!0,$.clearInterval(k.onKeyUpTimer),k.onKeyUpTimer=void 0)}}},_OnKeyUp:function(a){function b(){$.clearInterval(k.onKeyUpTimer),k.onKeyUpTimer=void 0,k.isUserTyping||(k.filter(),k.isUserTyping=null)}if(k.onKeyUp){var c=a||$.event,d=k.Evt.getKeyCode(c);k.isUserTyping=!1,13!==d&&9!==d&&27!==d&&38!==d&&40!==d?void 0===k.onKeyUpTimer&&(k.onKeyUpTimer=$.setInterval(b,k.onKeyUpDelay)):($.clearInterval(k.onKeyUpTimer),k.onKeyUpTimer=void 0)}},_OnKeyDown:function(){k.onKeyUp&&(k.isUserTyping=!0)},_OnInpBlur:function(){k.onKeyUp&&(k.isUserTyping=!1,$.clearInterval(k.onKeyUpTimer)),k.ezEditTable&&(k.editable&&k.ezEditTable.Editable.Set(),k.selectable&&k.ezEditTable.Selection.Set())},_OnInpFocus:function(a){var b=a||$.event;k.activeFilterId=this.getAttribute("id"),k.activeFlt=G.id(k.activeFilterId),k.popUpFilters&&(F.cancel(b),F.stop(b)),k.ezEditTable&&(k.editable&&k.ezEditTable.Editable.Remove(),k.selectable&&k.ezEditTable.Selection.Remove())},_OnSlcFocus:function(a){var b=a||$.event;if(k.activeFilterId=this.getAttribute("id"),k.activeFlt=G.id(k.activeFilterId),k.fillSlcOnDemand&&"0"===this.getAttribute("filled")){var c=this.getAttribute("ct");k.Cpt.dropdown._build(c)}k.popUpFilters&&(F.cancel(b),F.stop(b))},_OnSlcChange:function(a){if(k.activeFlt){var b=(k.activeFlt.getAttribute("colIndex"),a||$.event);k.popUpFilters&&F.stop(b),k.onSlcChange&&k.filter()}},_OnSlcBlur:function(){},_OnCheckListClick:function(){if(k.fillSlcOnDemand&&"0"===this.getAttribute("filled")){var a=this.getAttribute("ct");k.Cpt.checkList._build(a),k.Cpt.checkList.checkListDiv[a].onclick=null,k.Cpt.checkList.checkListDiv[a].title=""}},_OnCheckListFocus:function(){k.activeFilterId=this.firstChild.getAttribute("id"),k.activeFlt=G.id(k.activeFilterId)},_OnCheckListBlur:function(){},_OnBtnClick:function(){k.filter()},_OnSlcPagesChangeEvt:null,_EnableSlc:function(){this.firstChild.disabled=!1,this.firstChild.focus(),this.onclick=null},_Paging:{nextEvt:null,prevEvt:null,lastEvt:null,firstEvt:null}}}}return D(a,null,{init:{value:function(){if(!this._hasGrid){this.tbl||(this.tbl=G.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 a,b=this.cfg,c=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 M(this)),this.gridLayout&&(this.Cpt.gridLayout=new N(this),this.Cpt.gridLayout.init()),this.loader&&(this.Cpt.loader||(this.Cpt.loader=new O(this))),this.highlightKeywords&&(this.Cpt.highlightKeyword=new P(this)),this.popUpFilters&&(this.Cpt.popupFilter||(this.Cpt.popupFilter=new Q(this)),this.Cpt.popupFilter.init()),this.fltGrid)if(this.isFirstLoad){var d;if(!this.gridLayout){var e=G.tag(this.tbl,"thead");d=e.length>0?e[0].insertRow(this.filtersRowIndex):this.tbl.insertRow(this.filtersRowIndex),this.headersRow>1&&this.filtersRowIndex<=this.headersRow&&!this.popUpFilters&&this.headersRow++,this.popUpFilters&&this.headersRow++,d.className=this.fltsRowCssClass,this.isExternalFlt&&(!this.gridLayout||this.popUpFilters)&&(d.style.display="none")}this.nbFilterableRows=this.getRowsNb(),this.nbVisibleRows=this.nbFilterableRows,this.nbRows=this.tbl.rows.length;for(var f=0;c>f;f++){this.popUpFilters&&this.Cpt.popupFilter.build(f);var g=G.create(this.fltCellTag),h=this["col"+f],i=this.isExternalFlt&&this.externalFltTgtIds?this.externalFltTgtIds[f]:null;if(this.singleSearchFlt&&(g.colSpan=this.nbCells),this.gridLayout||d.appendChild(g),a=f==c-1&&this.displayBtn?this.fltSmallCssClass:this.fltCssClass,void 0===h&&(h=void 0===b["col_"+f]?this.fltTypeInp:H.lower(b["col_"+f])),this.singleSearchFlt&&(h=this.fltTypeInp,a=this.singleFltCssClass),h===this.fltTypeSlc||h===this.fltTypeMulti){this.Cpt.dropdown||(this.Cpt.dropdown=new R(this));var j=this.Cpt.dropdown,k=G.create(this.fltTypeSlc,["id",this.prfxFlt+f+"_"+this.id],["ct",f],["filled","0"]);if(h===this.fltTypeMulti&&(k.multiple=this.fltTypeMulti,k.title=j.multipleSlcTooltip),k.className=H.lower(h)===this.fltTypeSlc?a:this.fltMultiCssClass,i?(G.id(i).appendChild(k),this.externalFltEls.push(k)):g.appendChild(k),this.fltIds.push(this.prfxFlt+f+"_"+this.id),this.fillSlcOnDemand||j._build(f),F.add(k,"keypress",this.Evt._DetectKey),F.add(k,"change",this.Evt._OnSlcChange),F.add(k,"focus",this.Evt._OnSlcFocus),F.add(k,"blur",this.Evt._OnSlcBlur),this.fillSlcOnDemand){var l=G.createOpt(this.displayAllText,"");k.appendChild(l)}}else if(h===this.fltTypeCheckList){this.Cpt.checkList||(this.Cpt.checkList=new S(this));var m=G.create("div",["id",this.prfxCheckListDiv+f+"_"+this.id],["ct",f],["filled","0"]);m.className=this.Cpt.checkList.checkListDivCssClass,i?(G.id(i).appendChild(m),this.externalFltEls.push(m)):g.appendChild(m),this.Cpt.checkList.checkListDiv[f]=m,this.fltIds.push(this.prfxFlt+f+"_"+this.id),this.fillSlcOnDemand||this.Cpt.checkList._build(f),this.fillSlcOnDemand&&(F.add(m,"click",this.Evt._OnCheckListClick),m.appendChild(G.text(this.Cpt.checkList.activateCheckListTxt))),F.add(m,"click",this.Evt._OnCheckListFocus)}else{var n=h===this.fltTypeInp?"text":"hidden",o=G.create(this.fltTypeInp,["id",this.prfxFlt+f+"_"+this.id],["type",n],["ct",f]);if("hidden"!==n&&this.watermark&&o.setAttribute("placeholder",this.isWatermarkArray?this.watermark[f]:this.watermark),o.className=a,o.onfocus=this.Evt._OnInpFocus,i?(G.id(i).appendChild(o),this.externalFltEls.push(o)):g.appendChild(o),this.fltIds.push(this.prfxFlt+f+"_"+this.id),o.onkeypress=this.Evt._DetectKey,o.onkeydown=this.Evt._OnKeyDown,o.onkeyup=this.Evt._OnKeyUp,o.onblur=this.Evt._OnInpBlur,this.rememberGridValues){var p=this.Cpt.store.getFilterValues(this.fltsValuesCookie);" "!=p[f]&&this.setFilterValue(f,p[f],!1)}}if(f==c-1&&this.displayBtn){var q=G.create(this.fltTypeInp,["id",this.prfxValButton+f+"_"+this.id],["type","button"],["value",this.btnText]);q.className=this.btnCssClass,i?G.id(i).appendChild(q):g.appendChild(q),q.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 T(this),this.Cpt.rowsCounter.init()),this.statusBar&&(this.Cpt.statusBar=new U(this),this.Cpt.statusBar.init()),this.paging&&(this.Cpt.paging=new V(this),this.Cpt.paging.init()),this.btnReset&&(this.Cpt.clearButton=new W(this),this.Cpt.clearButton.init()),this.helpInstructions&&(this.Cpt.help=new X(this),this.Cpt.help.init()),this.hasColWidth&&!this.gridLayout&&this.setColWidths(),this.alternateBgs&&(this.Cpt.alternateRows=new Y(this),this.Cpt.alternateRows.init()),this.hasColOperation&&(this.Cpt.colOps=new Z(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||G.addClass(this.tbl,this.prfxTf),this.loader&&this.Cpt.loader.show("none"),this.hasExtensions&&this.LoadExtensions(),this.onFiltersLoaded&&this.onFiltersLoaded.call(null,this)}},writable:!0,configurable:!0},EvtManager:{value:function(a,b){function c(){if(a){switch(a){case d.Evt.name.filter:d.isModFilterFn?d.modFilterFn.call(null,d):d._filter();break;case d.Evt.name.dropdown:d.linkedFilters?d.Cpt.dropdown._build(e,!0):d.Cpt.dropdown._build(e,!1,f,g);break;case d.Evt.name.checklist:d.Cpt.checkList._build(e,f,g);break;case d.Evt.name.changepage:d.Cpt.paging._changePage(h);break;case d.Evt.name.clear:d._clearFilters(),d._filter();break;case d.Evt.name.changeresultsperpage:d.Cpt.paging._changeResultsPerPage();break;case d.Evt.name.resetvalues:d._resetValues(),d._filter();break;case d.Evt.name.resetpage:d.Cpt.paging._resetPage(d.pgNbCookie);break;case d.Evt.name.resetpagelength:d.Cpt.paging._resetPageLength(d.pgLenCookie);break;case d.Evt.name.sort:break;case d.Evt.name.loadextensions:d._LoadExtensions();break;case d.Evt.name.loadthemes:d._LoadThemes();break;default:d["_"+a].call(null,d,b)}d.statusBar&&d.Cpt.statusBar.message(""),d.loader&&d.Cpt.loader.show("none")}}var d=this,e=b&&void 0!==b.slcIndex?b.slcIndex:null,f=b&&void 0!==b.slcExternal?b.slcExternal:!1,g=b&&void 0!==b.slcId?b.slcId:null,h=b&&void 0!==b.pgIndex?b.pgIndex:null;if(this.loader||this.statusBar){try{this.Cpt.loader.show(""),this.Cpt.statusBar.message(this["msg"+a])}catch(i){}$.setTimeout(c,this.execDelay)}else c()},writable:!0,configurable:!0},ImportModule:{value:function(a){a.path&&a.name&&this.includeFile(a.name,a.path,a.init)},writable:!0,configurable:!0},LoadExtensions:{value:function(){if(!this.Ext){var a=this;this.Ext={list:{},add:function(b,c,d,e){var f=d.split("/")[d.split("/").length-1],g=new RegExp(f),h=d.replace(g,"");a.Ext.list[b]={name:b,description:c,file:f,path:h,callback:e}}}}this.EvtManager(this.Evt.name.loadextensions)},writable:!0,configurable:!0},_LoadExtensions:{value:function(){if(this.hasExtensions&&J.isArray(this.extensions.name)&&J.isArray(this.extensions.src))for(var a=this.extensions,b=0;b',this.btnPrevPageHtml='',this.btnNextPageHtml='',this.btnFirstPageHtml='',this.btnLastPageHtml='',this.loader=!0,this.loaderHtml='
',this.loaderText=null}},writable:!0,configurable:!0},remove:{value:function(){if(this.fltGrid&&this._hasGrid){var a=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.RemoveSort(),this.loader&&this.Cpt.loader.remove(),this.popUpFilters&&this.Cpt.popupFilter.destroy(),this.markActiveColumns&&this.clearActiveColumns(),(this.editable||this.selectable)&&this.RemoveEditable();for(var b=this.refRow;b0&&!c.startRow?void 0:c.startRow||a.refRow,c.scroll_into_view=c.scroll_into_view===!1?!1:!0,c.base_path=c.base_path||a.basePath+"ezEditTable/",c.editable=a.editable=a.cfg.editable,c.selection=a.selectable=a.cfg.selectable,a.selectable&&(c.default_selection=c.default_selection||"row"),c.active_cell_css=c.active_cell_css||"ezETSelectedCell",a._lastValidRowIndex=0,a._lastRowIndex=0,a.selectable){var e=function(b,c,d){if(a.validRowsIndex){var e,f=a.validRowsIndex,g=f.length,h="row"!==b.defaultSelection?c.parentNode:c,i="TD"===c.nodeName?c:null,j=void 0!==d?b.Event.GetKey(d):0,k=K.has(f,h.rowIndex),l=34===j||33===j?a.pagingLength||b.nbRowsPerPage:1;if(k)34!==j&&33!==j?(a._lastValidRowIndex=K.indexByValue(f,h.rowIndex),a._lastRowIndex=h.rowIndex):(e=34===j?a._lastValidRowIndex+l<=g-1?f[a._lastValidRowIndex+l]:[g-1]:a._lastValidRowIndex-l<=f[0]?f[0]:f[a._lastValidRowIndex-l],a._lastRowIndex=e,a._lastValidRowIndex=K.indexByValue(f,e),o(e));else{if(h.rowIndex>a._lastRowIndex)if(h.rowIndex>=f[g-1])e=f[g-1];else{var m=a._lastValidRowIndex+l;e=m>g-1?f[g-1]:f[m]}else if(h.rowIndex<=f[0])e=f[0];else{var n=f[a._lastValidRowIndex-l];e=n?n:f[0]}a._lastRowIndex=h.rowIndex,o(e)}var o=function(d){if("row"===b.defaultSelection)b.Selection.SelectRowByIndex(d);else{b.ClearSelections();var e=c.cellIndex,f=a.tbl.rows[d];"both"===b.defaultSelection&&b.Selection.SelectRowByIndex(d),f&&b.Selection.SelectCell(f.cells[e])}if(a.validRowsIndex.length!==a.getRowsNb()){var g=a.tbl.rows[d];g&&g.scrollIntoView(!1),i&&(i.cellIndex===a.getCellsNb()-1&&a.gridLayout?a.tblCont.scrollLeft=1e8:0===i.cellIndex&&a.gridLayout?a.tblCont.scrollLeft=0:i.scrollIntoView(!1))}}}},f=function(b,c){var d="row"!==b.defaultSelection?c.parentNode:c;if(a.paging&&a.nbPages>1){b.nbRowsPerPage=a.pagingLength;var e=a.validRowsIndex,f=e.length,g=parseInt(a.startPagingRow,10)+parseInt(a.pagingLength,10),h=d.rowIndex;h===e[f-1]&&a.currentPageNb!=a.nbPages?a.Cpt.paging.setPage("last"):h==e[0]&&1!==a.currentPageNb?a.Cpt.paging.setPage("first"):h>e[g-1]&&he[0]&&a.Cpt.paging.setPage("previous")}};if(a.paging&&(a.onAfterChangePage=function(a){var b=a.ezEditTable,c=b.Selection.GetActiveRow();c&&c.scrollIntoView(!1);var d=b.Selection.GetActiveCell();d&&d.scrollIntoView(!1)}),"row"===c.default_selection){var g=c.on_before_selected_row;c.on_before_selected_row=function(){f(arguments[0],arguments[1],arguments[2]),g&&g.call(null,arguments[0],arguments[1],arguments[2])};var h=c.on_after_selected_row;c.on_after_selected_row=function(){e(arguments[0],arguments[1],arguments[2]),h&&h.call(null,arguments[0],arguments[1],arguments[2]) +}}else{var i=c.on_before_selected_cell;c.on_before_selected_cell=function(){f(arguments[0],arguments[1],arguments[2]),i&&i.call(null,arguments[0],arguments[1],arguments[2])};var j=c.on_after_selected_cell;c.on_after_selected_cell=function(){e(arguments[0],arguments[1],arguments[2]),j&&j.call(null,arguments[0],arguments[1],arguments[2])}}}if(a.editable){var k=c.on_added_dom_row;if(c.on_added_dom_row=function(){a.nbFilterableRows++,a.paging?(a.nbRows++,a.nbVisibleRows++,a.nbFilterableRows++,a.paging=!1,a.Cpt.paging.destroy(),a.Cpt.paging.addPaging()):a.Cpt.rowsCounter.refresh(),a.alternateBgs&&a.Cpt.alternateRows.init(),k&&k.call(null,arguments[0],arguments[1],arguments[2])},c.actions&&c.actions["delete"]){var l=c.actions["delete"].on_after_submit;c.actions["delete"].on_after_submit=function(){a.nbFilterableRows--,a.paging?(a.nbRows--,a.nbVisibleRows--,a.nbFilterableRows--,a.paging=!1,a.Cpt.paging.destroy(),a.Cpt.paging.addPaging(!1)):a.Cpt.rowsCounter.refresh(),a.alternateBgs&&a.Cpt.alternateRows.init(),l&&l.call(null,arguments[0],arguments[1])}}}try{a.ezEditTable=new EditTable(a.id,c,b),a.ezEditTable.Init()}catch(m){console.log(c.err)}},writable:!0,configurable:!0},resetValues:{value:function(){this.EvtManager(this.Evt.name.resetvalues)},writable:!0,configurable:!0},_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)},writable:!0,configurable:!0},resetGridValues:{value:function(a){if(this.fillSlcOnDemand){var b=this.Cpt.store.getFilterValues(a),c=this.getFiltersByType(this.fltTypeSlc,!0),d=this.getFiltersByType(this.fltTypeMulti,!0);if(Number(b[b.length-1])===this.fltIds.length){for(var e=0;ev):N?(w=ab(a.replace(i,""),E),e=w>=v):P?(w=ab(a.replace(j,""),E),e=v>=w):O?(w=ab(a.replace(l,""),E),e=v>w):Q?(w=ab(a.replace(m,""),E),e=v.toString()!=w.toString()):R?(w=ab(a.replace(o,""),E),e=v.toString()==w.toString()):n.test(a)?e=f._containsStr(a.replace(n,""),b,null,!1):_(a,E)?(w=ab(a,E),e=v.toString()==w.toString()):J?e=H.isEmpty(b):K&&(e=!H.isEmpty(b));else if(f.hasColNbFormat&&f.colNbFormat[c]?(g=B(b,f.colNbFormat[c]),h=f.colNbFormat[c]):","===f.thousandsSeparator&&"."===f.decimalSeparator?(g=B(b,"us"),h="us"):(g=B(b,"eu"),h="eu"),y)e=g<=B(a.replace(i,""),h);else if(A)e=g>=B(a.replace(j,""),h);else if(x)e=gB(a.replace(l,""),h);else if(C)e=f._containsStr(a.replace(m,""),b)?!1:!0;else if(F)e=f._containsStr(a.replace(n,""),b,null,!1);else if(D)e=f._containsStr(a.replace(o,""),b,null,!0);else if(G)e=0===b.indexOf(a.replace(p,""))?!0:!1;else if(I){var S=a.replace(q,"");e=b.lastIndexOf(S,b.length-1)===b.length-1-(S.length-1)&&b.lastIndexOf(S,b.length-1)>-1?!0:!1}else if(J)e=H.isEmpty(b);else if(K)e=!H.isEmpty(b);else if(L)try{var T=a.replace(u,""),U=new RegExp(T);e=U.test(b)}catch(V){e=!1}else{var W=d["col_"+c];e=f._containsStr(a,b,W?W:f.fltTypeInp)}return e}if(this.fltGrid&&(this._hasGrid||this.isFirstLoad)){this.onBeforeFilter&&this.onBeforeFilter.call(null,this);var c=this.tbl.rows,d=this.cfg,e=0;this.validRowsIndex=[];var f=this;this.highlightKeywords&&this.Cpt.highlightKeyword.unhighlightAll(),this.popUpFilters&&this.Cpt.popupFilter.buildIcons(),this.markActiveColumns&&this.clearActiveColumns(),this.searchArgs=this.getFiltersValue();for(var g,h,i=new RegExp(this.leOperator),j=new RegExp(this.geOperator),k=new RegExp(this.lwOperator),l=new RegExp(this.grOperator),m=new RegExp(this.dfOperator),n=new RegExp(H.rgxEsc(this.lkOperator)),o=new RegExp(this.eqOperator),p=new RegExp(this.stOperator),q=new RegExp(this.enOperator),r=new RegExp(this.anOperator),s=(new RegExp(this.curExp),this.emOperator),t=this.nmOperator,u=new RegExp(H.rgxEsc(this.rgxOperator)),v=this.refRow;vC;C++){var D=this.searchArgs[this.singleSearchFlt?0:C],E=this.hasColDateType?this.colDateType[C]:this.defaultDateType;if(""!==D){var F=H.matchCase(this.getCellData(C,w[C]),this.matchCase),I=D.split(this.orOperator),J=I.length>1?!0:!1,L=D.split(this.anOperator),M=L.length>1?!0:!1;if(J||M){for(var N,O=!1,P=J?I:L,Q=0;Qj;j++)if(j===a&&""===d[f].style.display){var k=H.lower(this.getCellData(j,h[j])),l=this.colNbFormat?this.colNbFormat[a]:null,m=b?B(k,l):k;e.push(m)}}return e}},writable:!0,configurable:!0},getFilterValue:{value:function(a){if(this.fltGrid){var b,c=this.getFilterElement(a);if(!c)return"";var d=this.fltCol[a];if(d!==this.fltTypeMulti&&d!==this.fltTypeCheckList)b=c.value;else if(d===this.fltTypeMulti){b="";for(var e=0;e 1) { - for (var i = 0; i < arguments.length; i++) { - var arg = arguments[i]; - var argtype = typeof arg; - switch (str.lower(argtype)) { - case "number": - this.startRow = arg; - break; - case "object": - this.cfg = arg; - break; - } - } - } - - // configuration object - var f = this.cfg; - - //Start row et cols nb - this.refRow = this.startRow === null ? 2 : (this.startRow + 1); - try { - this.nbCells = this.getCellsNb(this.refRow); - } catch (e) { - this.nbCells = this.getCellsNb(0); - } - - //default script base path - this.basePath = f.base_path !== undefined ? f.base_path : ""; - - /*** filter types ***/ - this.fltTypeInp = "input"; - this.fltTypeSlc = "select"; - this.fltTypeMulti = "multiple"; - this.fltTypeCheckList = "checklist"; - this.fltTypeNone = "none"; - this.fltCol = []; //filter type of each column - - for (var j = 0; j < this.nbCells; j++) { - var cfgCol = f["col_" + j]; - var col = !cfgCol ? this.fltTypeInp : str.lower(cfgCol); - this.fltCol.push(col); - this["col" + j] = col; - } - - /*** Developer's additional methods ***/ - this.publicMethods = f.public_methods !== undefined ? f.public_methods : false; - - /*** filters' grid properties ***/ - - //enables/disables filter grid - this.fltGrid = f.grid === false ? false : true; - - /*** Grid layout ***/ - //enables/disables grid layout (fixed headers) - this.gridLayout = f.grid_layout ? true : false; - this.sourceTblHtml = null; - if (this.gridLayout) { - //Firefox does not support outerHTML property... - if (this.tbl.outerHTML === undefined) { - setOuterHtml(); - } - this.sourceTblHtml = this.tbl.outerHTML; - } - /*** ***/ - - this.filtersRowIndex = f.filters_row_index || 0; - this.headersRow = f.headers_row_index || (this.filtersRowIndex === 0 ? 1 : 0); - - if (this.gridLayout) { - if (this.headersRow > 1) { - this.filtersRowIndex = this.headersRow + 1; - } else { - this.filtersRowIndex = 1; - this.headersRow = 0; - } - } - - //defines tag of the cells containing filters (td/th) - this.fltCellTag = f.filters_cell_tag !== "th" || f.filters_cell_tag !== "td" ? "td" : f.filters_cell_tag; - - //stores filters ids - this.fltIds = []; - //stores filters DOM elements - this.fltElms = []; - //stores filters values - this.searchArgs = null; - //stores table data - this.tblData = []; - //stores valid rows indexes (rows visible upon filtering) - this.validRowsIndex = null; - //stores filters row element - this.fltGridEl = null; - //is first load boolean - this.isFirstLoad = true; - //container div for paging elements, reset btn etc. - this.infDiv = null; - //div for rows counter - this.lDiv = null; - //div for reset button and results per page select - this.rDiv = null; - //div for paging elements - this.mDiv = null; - //table container div for fixed headers (IE only) - this.contDiv = null; - - //defines css class for div containing paging elements, rows counter etc. - this.infDivCssClass = f.inf_div_css_class || "inf"; - //defines css class for left div - this.lDivCssClass = f.left_div_css_class || "ldiv"; - //defines css class for right div - this.rDivCssClass = f.right_div_css_class || "rdiv"; - //defines css class for mid div - this.mDivCssClass = f.middle_div_css_class || "mdiv"; - //table container div css class - this.contDivCssClass = f.content_div_css_class || "cont"; - - /*** filters' grid appearance ***/ - //stylesheet file - this.stylesheet = f.stylesheet || this.basePath + "filtergrid.css"; - this.stylesheetId = this.id + "_style"; - //defines css class for filters row - this.fltsRowCssClass = f.flts_row_css_class || "fltrow"; - //enables/disables icons (paging, reset button) - this.enableIcons = f.enable_icons === false ? false : true; - //enables/disbles rows alternating bg colors - this.alternateBgs = f.alternate_rows === true ? true : false; - //defines widths of columns - this.hasColWidth = f.col_width === true ? true : false; - this.colWidth = this.hasColWidth ? f.col_width : null; - //enables/disables fixed headers - this.fixedHeaders = f.fixed_headers === true ? true : false; - //tbody height if fixed headers enabled - this.tBodyH = !isNaN(f.tbody_height) ? f.tbody_height : 200; - //defines css class for filters - this.fltCssClass = f.flt_css_class || "flt"; - //defines css class for multiple selects filters - this.fltMultiCssClass = f.flt_multi_css_class || "flt_multi"; - //defines css class for filters - this.fltSmallCssClass = f.flt_small_css_class || "flt_s"; - //defines css class for single-filter - this.singleFltCssClass = f.single_flt_css_class || "single_flt"; - this.isStartBgAlternate = true; - - /*** filters' grid behaviours ***/ - //enables/disables enter key - this.enterKey = f.enter_key === false ? false : true; - //enables/disables alternative fn call - this.isModFilterFn = f.mod_filter_fn === true ? true : false; - // used by tf_DetectKey fn - this.modFilterFn = this.isModFilterFn ? f.mod_filter_fn : null; - //calls function before filtering starts - this.onBeforeFilter = types.isFn(f.on_before_filter) ? f.on_before_filter : null; - //calls function after filtering - this.onAfterFilter = types.isFn(f.on_after_filter) ? f.on_after_filter : null; - //enables/disables case sensitivity - this.matchCase = f.match_case === true ? true : false; - //enables/disbles exact match for search - this.exactMatch = f.exact_match === true ? true : false; - //refreshes drop-down lists upon validation - this.linkedFilters = f.linked_filters === true ? true : false; - //wheter excluded options are disabled - this.disableExcludedOptions = f.disable_excluded_options === true ? true : false; - //stores active filter element - this.activeFlt = null; - //id of active filter - this.activeFilterId = null; - //enables/disbles column operation(sum,mean) - this.hasColOperation = f.col_operation ? true : false; - this.colOperation = null; - //enables always visible rows - this.hasVisibleRows = f.rows_always_visible ? true : false; - //array containing always visible rows - this.visibleRows = this.hasVisibleRows ? f.rows_always_visible : []; - //defines search type: include or exclude - this.searchType = f.search_type || "include"; - //enables/disables external filters generation - this.isExternalFlt = f.external_flt_grid === true ? true : false; - //array containing ids of external elements containing filters - this.externalFltTgtIds = f.external_flt_grid_ids || null; - //stores filters elements if isExternalFlt is true - this.externalFltEls = []; - //delays any filtering process if loader true - this.execDelay = !isNaN(f.exec_delay) ? parseInt(f.exec_delay, 10) : 100; - //calls function when filters grid loaded - this.onFiltersLoaded = types.isFn(f.on_filters_loaded) ? f.on_filters_loaded : null; - //enables/disables single filter search - this.singleSearchFlt = f.single_search_filter === true ? true : false; - //calls function after row is validated - this.onRowValidated = types.isFn(f.on_row_validated) ? f.on_row_validated : null; - //array defining columns for customCellData event - this.customCellDataCols = f.custom_cell_data_cols ? f.custom_cell_data_cols : []; - //calls custom function for retrieving cell data - this.customCellData = types.isFn(f.custom_cell_data) ? f.custom_cell_data : null; - //input watermark text array - this.watermark = f.watermark || ""; - this.isWatermarkArray = types.isArray(this.watermark); - //id of toolbar container element - this.toolBarTgtId = f.toolbar_target_id || null; - //enables/disables help div - this.helpInstructions = f.help_instructions || false; - //popup filters - this.popUpFilters = f.popup_filters === true ? true : false; - //active columns color - this.markActiveColumns = f.mark_active_columns === true ? true : false; - //defines css class for active column header - this.activeColumnsCssClass = f.active_columns_css_class || "activeHeader"; - //calls function before active column header is marked - this.onBeforeActiveColumn = types.isFn(f.on_before_active_column) ? f.on_before_active_column : null; - //calls function after active column header is marked - this.onAfterActiveColumn = types.isFn(f.on_after_active_column) ? f.on_after_active_column : null; - - /*** select filter's customisation and behaviours ***/ - //defines 1st option text - this.displayAllText = f.display_all_text || ""; - //enables/disables empty option in combo-box filters - this.enableEmptyOption = f.enable_empty_option === true ? true : false; - //defines empty option text - this.emptyText = f.empty_text || "(Empty)"; - //enables/disables non empty option in combo-box filters - this.enableNonEmptyOption = f.enable_non_empty_option === true ? true : false; - //defines empty option text - this.nonEmptyText = f.non_empty_text || "(Non empty)"; - //enables/disables onChange event on combo-box - this.onSlcChange = f.on_change === false ? false : true; - //enables/disables select options sorting - this.sortSlc = f.sort_select === false ? false : true; - //enables/disables ascending numeric options sorting - this.isSortNumAsc = f.sort_num_asc === true ? true : false; - this.sortNumAsc = this.isSortNumAsc ? f.sort_num_asc : null; - //enables/disables descending numeric options sorting - this.isSortNumDesc = f.sort_num_desc === true ? true : false; - this.sortNumDesc = this.isSortNumDesc ? f.sort_num_desc : null; - //enabled selects are populated on demand - this.fillSlcOnDemand = f.fill_slc_on_demand === true ? true : false; - this.hasCustomSlcOptions = types.isObj(f.custom_slc_options) ? true : false; - this.customSlcOptions = types.isArray(f.custom_slc_options) ? f.custom_slc_options : null; - - /*** Filter operators ***/ - this.rgxOperator = f.regexp_operator || "rgx:"; - this.emOperator = f.empty_operator || "[empty]"; - this.nmOperator = f.nonempty_operator || "[nonempty]"; - this.orOperator = f.or_operator || "||"; - this.anOperator = f.and_operator || "&&"; - this.grOperator = f.greater_operator || ">"; - this.lwOperator = f.lower_operator || "<"; - this.leOperator = f.lower_equal_operator || "<="; - this.geOperator = f.greater_equal_operator || ">="; - this.dfOperator = f.different_operator || "!"; - this.lkOperator = f.like_operator || "*"; - this.eqOperator = f.equal_operator || "="; - this.stOperator = f.start_with_operator || "{"; - this.enOperator = f.end_with_operator || "}"; - this.curExp = f.cur_exp || "^[\u00a5\u00a3\u20ac$]"; - this.separator = f.separator || ","; - - /*** rows counter ***/ - //show/hides rows counter - this.rowsCounter = f.rows_counter === true ? true : false; - - /*** status bar ***/ - //show/hides status bar - this.statusBar = f.status_bar === true ? true : false; - - /*** loader ***/ - //enables/disables loader/spinner indicator - this.loader = f.loader === true ? true : false; - - /*** validation - reset buttons/links ***/ - //show/hides filter's validation button - this.displayBtn = f.btn === true ? true : false; - //defines validation button text - this.btnText = f.btn_text || (!this.enableIcons ? "Go" : ""); - //defines css class for validation button - this.btnCssClass = f.btn_css_class || (!this.enableIcons ? "btnflt" : "btnflt_icon"); - //show/hides reset link - this.btnReset = f.btn_reset === true ? true : false; - //defines css class for reset button - this.btnResetCssClass = f.btn_reset_css_class || "reset"; - //callback function before filters are cleared - this.onBeforeReset = types.isFn(f.on_before_reset) ? f.on_before_reset : null; - //callback function after filters are cleared - this.onAfterReset = types.isFn(f.on_after_reset) ? f.on_after_reset : null; - - /*** paging ***/ - //enables/disables table paging - this.paging = f.paging === true ? true : false; - this.nbVisibleRows = 0; //nb visible rows - this.nbHiddenRows = 0; //nb hidden rows - - /*** webfx sort adapter ***/ - //enables/disables default table sorting - this.sort = f.sort === true ? true : false; - //indicates if sort is set (used in tfAdapter.sortabletable.js) - this.isSortEnabled = false; - //indicates if tables was sorted - this.sorted = false; - this.sortConfig = f.sort_config || {}; - this.sortConfig.name = this.sortConfig["name"] !== undefined ? f.sort_config.name : "sortabletable"; - this.sortConfig.src = this.sortConfig["src"] !== undefined ? f.sort_config.src : this.basePath + "sortabletable.js"; - this.sortConfig.adapterSrc = this.sortConfig["adapter_src"] !== undefined ? f.sort_config.adapter_src : this.basePath + "tfAdapter.sortabletable.js"; - this.sortConfig.initialize = this.sortConfig["initialize"] !== undefined ? f.sort_config.initialize : function (o) { - if (o.SetSortTable) { - o.SetSortTable(); - } - }; - this.sortConfig.sortTypes = types.isArray(this.sortConfig["sort_types"]) ? f.sort_config.sort_types : []; - this.sortConfig.sortCol = this.sortConfig["sort_col"] !== undefined ? f.sort_config.sort_col : null; - this.sortConfig.asyncSort = this.sortConfig["async_sort"] === true ? true : false; - this.sortConfig.triggerIds = types.isArray(this.sortConfig["sort_trigger_ids"]) ? f.sort_config.sort_trigger_ids : []; - - /*** ezEditTable extension ***/ - //enables/disables table selection feature - this.selectable = f.selectable === true ? true : false; - //enables/disables editable table feature - this.editable = f.editable === true ? true : false; - this.ezEditTableConfig = f.ezEditTable_config || {}; - this.ezEditTableConfig.name = this.ezEditTableConfig["name"] !== undefined ? f.ezEditTable_config.name : "ezedittable"; - this.ezEditTableConfig.src = this.ezEditTableConfig["src"] !== undefined ? f.ezEditTable_config.src : this.basePath + "ezEditTable/ezEditTable.js"; - //ezEditTable stylesheet not imported by default as filtergrid.css - //applies - this.ezEditTableConfig.loadStylesheet = this.ezEditTableConfig["loadStylesheet"] === true ? true : false; - this.ezEditTableConfig.stylesheet = this.ezEditTableConfig["stylesheet"] || this.basePath + "ezEditTable/ezEditTable.css"; - this.ezEditTableConfig.stylesheetName = this.ezEditTableConfig["stylesheetName"] !== undefined ? f.ezEditTable_config.stylesheetName : "ezEditTableCss"; - this.ezEditTableConfig.err = "Failed to instantiate EditTable " + "object.\n\"ezEditTable\" module may not be available."; - - /*** onkeyup event ***/ - //enables/disables onkeyup event, table is filtered when user stops - //typing - this.onKeyUp = f.on_keyup === true ? true : false; - //onkeyup delay timer (msecs) - this.onKeyUpDelay = !isNaN(f.on_keyup_delay) ? f.on_keyup_delay : 900; - this.isUserTyping = null; //typing indicator - this.onKeyUpTimer = undefined; - - /*** keyword highlighting ***/ - //enables/disables keyword highlighting - this.highlightKeywords = f.highlight_keywords === true ? true : false; - - /*** data types ***/ - //defines default date type (european DMY) - this.defaultDateType = f.default_date_type || "DMY"; - //defines default thousands separator - //US = ',' EU = '.' - this.thousandsSeparator = f.thousands_separator || ","; - //defines default decimal separator - //US & javascript = '.' EU = ',' - this.decimalSeparator = f.decimal_separator || "."; - //enables number format per column - this.hasColNbFormat = f.col_number_format === true ? true : false; - //array containing columns nb formats - this.colNbFormat = types.isArray(this.hasColNbFormat) ? f.col_number_format : null; - //enables date type per column - this.hasColDateType = f.col_date_type === true ? true : false; - //array containing columns date type - this.colDateType = types.isArray(this.hasColDateType) ? f.col_date_type : null; - - /*** status messages ***/ - //filtering - this.msgFilter = f.msg_filter || "Filtering data..."; - //populating drop-downs - this.msgPopulate = f.msg_populate || "Populating filter..."; - //populating drop-downs - this.msgPopulateCheckList = f.msg_populate_checklist || "Populating list..."; - //changing paging page - this.msgChangePage = f.msg_change_page || "Collecting paging data..."; - //clearing filters - this.msgClear = f.msg_clear || "Clearing filters..."; - //changing nb results/page - this.msgChangeResults = f.msg_change_results || "Changing results per page..."; - //re-setting grid values - this.msgResetValues = f.msg_reset_grid_values || "Re-setting filters values..."; - //re-setting page - this.msgResetPage = f.msg_reset_page || "Re-setting page..."; - //re-setting page length - this.msgResetPageLength = f.msg_reset_page_length || "Re-setting page length..."; - //table sorting - this.msgSort = f.msg_sort || "Sorting data..."; - //extensions loading - this.msgLoadExtensions = f.msg_load_extensions || "Loading extensions..."; - //themes loading - this.msgLoadThemes = f.msg_load_themes || "Loading theme(s)..."; - - /*** ids prefixes ***/ - //css class name added to table - this.prfxTf = "TF"; - //filters (inputs - selects) - this.prfxFlt = "flt"; - //validation button - this.prfxValButton = "btn"; - //container div for paging elements, rows counter etc. - this.prfxInfDiv = "inf_"; - //left div - this.prfxLDiv = "ldiv_"; - //right div - this.prfxRDiv = "rdiv_"; - //middle div - this.prfxMDiv = "mdiv_"; - //table container if fixed headers enabled - this.prfxContentDiv = "cont_"; - //checklist filter container div - this.prfxCheckListDiv = "chkdiv_"; - //pages select - this.prfxSlcPages = "slcPages_"; - //results per page select - this.prfxSlcResults = "slcResults_"; - //label preciding results per page select - this.prfxSlcResultsTxt = "slcResultsTxt_"; - //span containing next page button - this.prfxBtnNextSpan = "btnNextSpan_"; - //span containing previous page button - this.prfxBtnPrevSpan = "btnPrevSpan_"; - //span containing last page button - this.prfxBtnLastSpan = "btnLastSpan_"; - //span containing first page button - this.prfxBtnFirstSpan = "btnFirstSpan_"; - //next button - this.prfxBtnNext = "btnNext_"; - //previous button - this.prfxBtnPrev = "btnPrev_"; - //last button - this.prfxBtnLast = "btnLast_"; - //first button - this.prfxBtnFirst = "btnFirst_"; - //span for tot nb pages - this.prfxPgSpan = "pgspan_"; - //span preceding pages select (contains 'Page') - this.prfxPgBeforeSpan = "pgbeforespan_"; - //span following pages select (contains ' of ') - this.prfxPgAfterSpan = "pgafterspan_"; - //rows counter div - this.prfxCounter = "counter_"; - //nb displayed rows label - this.prfxTotRows = "totrows_span_"; - //label preceding nb rows label - this.prfxTotRowsTxt = "totRowsTextSpan_"; - //span containing reset button - this.prfxResetSpan = "resetspan_"; - //loader div - this.prfxLoader = "load_"; - //status bar div - this.prfxStatus = "status_"; - //status bar label - this.prfxStatusSpan = "statusSpan_"; - //text preceding status bar label - this.prfxStatusTxt = "statusText_"; - //filter values cookie - this.prfxCookieFltsValues = "tf_flts_"; - //page nb cookie - this.prfxCookiePageNb = "tf_pgnb_"; - //page length cookie - this.prfxCookiePageLen = "tf_pglen_"; - //div containing grid elements if grid_layout true - this.prfxMainTblCont = "gridCont_"; - //div containing table if grid_layout true - this.prfxTblCont = "tblCont_"; - //div containing headers table if grid_layout true - this.prfxHeadTblCont = "tblHeadCont_"; - //headers' table if grid_layout true - this.prfxHeadTbl = "tblHead_"; - //id of td containing the filter if grid_layout true - this.prfxGridFltTd = "_td_"; - //id of th containing column header if grid_layout true - this.prfxGridTh = "tblHeadTh_"; - //id prefix for help elements - this.prfxHelpSpan = "helpSpan_"; - //id prefix for help elements - this.prfxHelpDiv = "helpDiv_"; - //id prefix for pop-up filter span - this.prfxPopUpSpan = "popUpSpan_"; - //id prefix for pop-up div containing filter - this.prfxPopUpDiv = "popUpDiv_"; - - /*** cookies ***/ - this.hasStoredValues = false; - //remembers filters values on page load - this.rememberGridValues = f.remember_grid_values === true ? true : false; - //cookie storing filter values - this.fltsValuesCookie = this.prfxCookieFltsValues + this.id; - //remembers page nb on page load - this.rememberPageNb = this.paging && f.remember_page_number ? true : false; - //cookie storing page nb - this.pgNbCookie = this.prfxCookiePageNb + this.id; - //remembers page length on page load - this.rememberPageLen = this.paging && f.remember_page_length ? true : false; - //cookie storing page length - this.pgLenCookie = this.prfxCookiePageLen + this.id; - - /*** extensions ***/ - //imports external script - this.hasExtensions = f.extensions === true ? true : false; - this.extensions = this.hasExtensions ? f.extensions : null; - - /*** themes ***/ - this.enableDefaultTheme = f.enable_default_theme === true ? true : false; - //imports themes - this.hasThemes = (f.enable_default_theme || (f.themes && types.isObj(f.themes))) ? true : false; - this.themes = this.hasThemes ? f.themes : null; - //themes path - this.themesPath = f.themes_path || this.basePath + "TF_Themes/"; - - // Components - 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 - }; - - /*** TF events ***/ - var o = 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" - }, - getKeyCode: function (evt) { - return evt.charCode ? evt.charCode : (evt.keyCode ? evt.keyCode : (evt.which ? evt.which : 0)); - }, - /*==================================================== - - Detects key for a given element - =====================================================*/ - _DetectKey: function (e) { - if (!o.enterKey) { - return; - } - var _evt = e || global.event; - if (_evt) { - var key = o.Evt.getKeyCode(_evt); - if (key === 13) { - o._filter(); - evt.cancel(_evt); - evt.stop(_evt); - } else { - o.isUserTyping = true; - global.clearInterval(o.onKeyUpTimer); - o.onKeyUpTimer = undefined; - } - } //if evt - }, - /*==================================================== - - onkeyup event for text filters - =====================================================*/ - _OnKeyUp: function (e) { - if (!o.onKeyUp) { - return; - } - var _evt = e || global.event; - var key = o.Evt.getKeyCode(_evt); - o.isUserTyping = false; - - function filter() { - global.clearInterval(o.onKeyUpTimer); - o.onKeyUpTimer = undefined; - if (!o.isUserTyping) { - o.filter(); - o.isUserTyping = null; - } - } - - if (key !== 13 && key !== 9 && key !== 27 && key !== 38 && key !== 40) { - if (o.onKeyUpTimer === undefined) { - o.onKeyUpTimer = global.setInterval(filter, o.onKeyUpDelay); - } - } else { - global.clearInterval(o.onKeyUpTimer); - o.onKeyUpTimer = undefined; - } - }, - /*==================================================== - - onkeydown event for input filters - =====================================================*/ - _OnKeyDown: function (e) { - if (!o.onKeyUp) { - return; - } - o.isUserTyping = true; - }, - /*==================================================== - - onblur event for input filters - =====================================================*/ - _OnInpBlur: function (e) { - if (o.onKeyUp) { - o.isUserTyping = false; - global.clearInterval(o.onKeyUpTimer); - } - if (o.ezEditTable) { - if (o.editable) { - o.ezEditTable.Editable.Set(); - } - if (o.selectable) { - o.ezEditTable.Selection.Set(); - } - } - }, - /*==================================================== - - onfocus event for input filters - =====================================================*/ - _OnInpFocus: function (e) { - var _evt = e || global.event; - o.activeFilterId = this.getAttribute("id"); - o.activeFlt = dom.id(o.activeFilterId); - if (o.popUpFilters) { - evt.cancel(_evt); - evt.stop(_evt); - } - if (o.ezEditTable) { - if (o.editable) { - o.ezEditTable.Editable.Remove(); - } - if (o.selectable) { - o.ezEditTable.Selection.Remove(); - } - } - }, - /*==================================================== - - onfocus event for select filters - =====================================================*/ - _OnSlcFocus: function (e) { - var _evt = e || global.event; - o.activeFilterId = this.getAttribute("id"); - o.activeFlt = dom.id(o.activeFilterId); - // select is populated when element has focus - if (o.fillSlcOnDemand && this.getAttribute("filled") === "0") { - var ct = this.getAttribute("ct"); - o.Cpt.dropdown._build(ct); - } - if (o.popUpFilters) { - evt.cancel(_evt); - evt.stop(_evt); - } - }, - /*==================================================== - - onchange event for select filters - =====================================================*/ - _OnSlcChange: function (e) { - if (!o.activeFlt) { - return; - } - var colIndex = o.activeFlt.getAttribute("colIndex"); - //Checks filter is a checklist and caller is not null - // if(o.activeFlt && colIndex && - // o['col'+colIndex]===o.fltTypeCheckList && - // !o.Evt._OnSlcChange.caller){ return; } - var _evt = e || global.event; - if (o.popUpFilters) { - evt.stop(_evt); - } - if (o.onSlcChange) { - o.filter(); - } - }, - /*==================================================== - - onblur event for select filters - =====================================================*/ - _OnSlcBlur: function (e) {}, - /*==================================================== - - onclick event for checklist filters - =====================================================*/ - _OnCheckListClick: function () { - if (o.fillSlcOnDemand && this.getAttribute("filled") === "0") { - var ct = this.getAttribute("ct"); - o.Cpt.checkList._build(ct); - o.Cpt.checkList.checkListDiv[ct].onclick = null; - o.Cpt.checkList.checkListDiv[ct].title = ""; - } - }, - /*==================================================== - - onclick event for checklist filter container - =====================================================*/ - _OnCheckListFocus: function (e) { - o.activeFilterId = this.firstChild.getAttribute("id"); - o.activeFlt = dom.id(o.activeFilterId); - }, - _OnCheckListBlur: function (e) {}, - /*==================================================== - - onclick event for validation button - (btn property) - =====================================================*/ - _OnBtnClick: function () { - o.filter(); - }, - _OnSlcPagesChangeEvt: null, //used by sort adapter - /*==================================================== - - onclick event slc parent node (enables filters) - IE only - =====================================================*/ - _EnableSlc: function () { - this.firstChild.disabled = false; - this.firstChild.focus(); - this.onclick = null; - }, - - _Paging: { //used by sort adapter - nextEvt: null, - prevEvt: null, - lastEvt: null, - firstEvt: null - } - }; - }; - - _classProps(TableFilter, null, { - init: { - writable: true, - value: function () { - if (this._hasGrid) { - return; - } - if (!this.tbl) { - this.tbl = dom.id(this.id); - } - if (this.gridLayout) { - this.refRow = this.startRow === null ? 0 : this.startRow; - } - if (this.popUpFilters && ((this.filtersRowIndex === 0 && this.headersRow === 1) || this.gridLayout)) { - this.headersRow = 0; - } - var f = this.cfg, n = this.singleSearchFlt ? 1 : this.nbCells, inpclass; - - if (window["tf_" + this.id] === undefined) { - window["tf_" + this.id] = this; - } - - //loads stylesheet if not imported - //Issues with browsers != IE, IE rules in this case - this.includeFile(this.stylesheetId, this.stylesheet, null, "link"); - - //loads theme - if (this.hasThemes) { - this._LoadThemes(); - } - - if (this.rememberGridValues || this.rememberPageNb || this.rememberPageLen) { - var Store = _modulesStore.Store; - this.Cpt.store = new Store(this); - } - - if (this.gridLayout) { - var GridLayout = _modulesGridLayoutf.GridLayout; - this.Cpt.gridLayout = new GridLayout(this); - this.Cpt.gridLayout.init(); - } - - if (this.loader) { - if (!this.Cpt.loader) { - var Loader = require("modules/loader").Loader; - this.Cpt.loader = new Loader(this); - } - } - - if (this.highlightKeywords) { - var Highlight = require("modules/highlightKeywords").HighlightKeyword; - this.Cpt.highlightKeyword = new Highlight(this); - } - - if (this.popUpFilters) { - if (!this.Cpt.popupFilter) { - var PopupFilter = require("modules/popupFilter").PopupFilter; - this.Cpt.popupFilter = new PopupFilter(this); - } - this.Cpt.popupFilter.init(); - } - - //filters grid is not generated - if (!this.fltGrid) { - this.refRow = this.refRow - 1; - if (this.gridLayout) { - this.refRow = 0; - } - this.nbFilterableRows = this.getRowsNb(); - this.nbVisibleRows = this.nbFilterableRows; - this.nbRows = this.nbFilterableRows + this.refRow; - } else { - if (this.isFirstLoad) { - var fltrow; - if (!this.gridLayout) { - var thead = dom.tag(this.tbl, "thead"); - if (thead.length > 0) { - fltrow = thead[0].insertRow(this.filtersRowIndex); - } else { - fltrow = this.tbl.insertRow(this.filtersRowIndex); - } - - if (this.headersRow > 1 && this.filtersRowIndex <= this.headersRow && !this.popUpFilters) { - this.headersRow++; - } - if (this.popUpFilters) { - this.headersRow++; - } - - fltrow.className = this.fltsRowCssClass; - //Disable for grid_layout - if (this.isExternalFlt && (!this.gridLayout || this.popUpFilters)) { - fltrow.style.display = "none"; - } - } - - this.nbFilterableRows = this.getRowsNb(); - this.nbVisibleRows = this.nbFilterableRows; - this.nbRows = this.tbl.rows.length; - - for (var i = 0; i < n; i++) { - // this loop adds filters - - if (this.popUpFilters) { - this.Cpt.popupFilter.build(i); - } - - var fltcell = dom.create(this.fltCellTag), col = this["col" + i], externalFltTgtId = this.isExternalFlt && this.externalFltTgtIds ? this.externalFltTgtIds[i] : null; - - if (this.singleSearchFlt) { - fltcell.colSpan = this.nbCells; - } - if (!this.gridLayout) { - fltrow.appendChild(fltcell); - } - inpclass = (i == n - 1 && this.displayBtn) ? this.fltSmallCssClass : this.fltCssClass; - - if (col === undefined) { - col = f["col_" + i] === undefined ? this.fltTypeInp : str.lower(f["col_" + i]); - } - - //only 1 input for single search - if (this.singleSearchFlt) { - col = this.fltTypeInp; - inpclass = this.singleFltCssClass; - } - - //drop-down filters - if (col === this.fltTypeSlc || col === this.fltTypeMulti) { - if (!this.Cpt.dropdown) { - var Dropdown = require("modules/dropdown").Dropdown; - this.Cpt.dropdown = new Dropdown(this); - } - var dropdown = this.Cpt.dropdown; - - var slc = dom.create(this.fltTypeSlc, ["id", this.prfxFlt + i + "_" + this.id], ["ct", i], ["filled", "0"]); - - if (col === this.fltTypeMulti) { - slc.multiple = this.fltTypeMulti; - slc.title = dropdown.multipleSlcTooltip; - } - slc.className = str.lower(col) === this.fltTypeSlc ? inpclass : this.fltMultiCssClass; // for ie<=6 - - //filter is appended in desired external element - if (externalFltTgtId) { - dom.id(externalFltTgtId).appendChild(slc); - this.externalFltEls.push(slc); - } else { - fltcell.appendChild(slc); - } - - this.fltIds.push(this.prfxFlt + i + "_" + this.id); - - if (!this.fillSlcOnDemand) { - dropdown._build(i); - } - - evt.add(slc, "keypress", this.Evt._DetectKey); - evt.add(slc, "change", this.Evt._OnSlcChange); - evt.add(slc, "focus", this.Evt._OnSlcFocus); - evt.add(slc, "blur", this.Evt._OnSlcBlur); - - //1st option is created here since dropdown.build isn't - //invoked - if (this.fillSlcOnDemand) { - var opt0 = dom.createOpt(this.displayAllText, ""); - slc.appendChild(opt0); - } - } - // checklist - else if (col === this.fltTypeCheckList) { - if (!this.Cpt.checkList) { - var CheckList = require("modules/checkList").CheckList; - this.Cpt.checkList = new CheckList(this); - } - - var divCont = dom.create("div", ["id", this.prfxCheckListDiv + i + "_" + this.id], ["ct", i], ["filled", "0"]); - divCont.className = this.Cpt.checkList.checkListDivCssClass; - - //filter is appended in desired element - if (externalFltTgtId) { - dom.id(externalFltTgtId).appendChild(divCont); - this.externalFltEls.push(divCont); - } else { - fltcell.appendChild(divCont); - } - - this.Cpt.checkList.checkListDiv[i] = divCont; - this.fltIds.push(this.prfxFlt + i + "_" + this.id); - if (!this.fillSlcOnDemand) { - this.Cpt.checkList._build(i); - } - - if (this.fillSlcOnDemand) { - evt.add(divCont, "click", this.Evt._OnCheckListClick); - divCont.appendChild(dom.text(this.Cpt.checkList.activateCheckListTxt)); - } - - evt.add(divCont, "click", this.Evt._OnCheckListFocus); - } else { - //show/hide input - var inptype = col === this.fltTypeInp ? "text" : "hidden"; - var inp = dom.create(this.fltTypeInp, ["id", this.prfxFlt + i + "_" + this.id], ["type", inptype], ["ct", i]); - if (inptype !== "hidden" && this.watermark) { - inp.setAttribute("placeholder", this.isWatermarkArray ? this.watermark[i] : this.watermark); - } - inp.className = inpclass; - inp.onfocus = this.Evt._OnInpFocus; - - //filter is appended in desired element - if (externalFltTgtId) { - dom.id(externalFltTgtId).appendChild(inp); - this.externalFltEls.push(inp); - } else { - fltcell.appendChild(inp); - } - - this.fltIds.push(this.prfxFlt + i + "_" + this.id); - - inp.onkeypress = this.Evt._DetectKey; - inp.onkeydown = this.Evt._OnKeyDown; - inp.onkeyup = this.Evt._OnKeyUp; - inp.onblur = this.Evt._OnInpBlur; - - if (this.rememberGridValues) { - var flts_values = this.Cpt.store.getFilterValues(this.fltsValuesCookie); - if (flts_values[i] != " ") { - this.setFilterValue(i, flts_values[i], false); - } - } - } - // this adds submit button - if (i == n - 1 && this.displayBtn) { - var btn = dom.create(this.fltTypeInp, ["id", this.prfxValButton + i + "_" + this.id], ["type", "button"], ["value", this.btnText]); - btn.className = this.btnCssClass; - - //filter is appended in desired element - if (externalFltTgtId) { - dom.id(externalFltTgtId).appendChild(btn); - } else { - fltcell.appendChild(btn); - } - - btn.onclick = this.Evt._OnBtnClick; - } //if - } // for i - } else { - this._resetGrid(); - } //if isFirstLoad - } //if this.fltGrid - - /* Filter behaviours */ - if (this.rowsCounter) { - var RowsCounter = require("modules/rowsCounter").RowsCounter; - this.Cpt.rowsCounter = new RowsCounter(this); - this.Cpt.rowsCounter.init(); - } - if (this.statusBar) { - // this.SetStatusBar(); - var StatusBar = require("modules/statusBar").StatusBar; - this.Cpt.statusBar = new StatusBar(this); - this.Cpt.statusBar.init(); - } - if (this.paging) { - var Paging = require("modules/paging").Paging; - this.Cpt.paging = new Paging(this); - this.Cpt.paging.init(); - } - if (this.btnReset) { - var ClearButton = require("modules/clearButton").ClearButton; - this.Cpt.clearButton = new ClearButton(this); - this.Cpt.clearButton.init(); - } - if (this.helpInstructions) { - var Help = require("modules/help").Help; - this.Cpt.help = new Help(this); - this.Cpt.help.init(); - } - if (this.hasColWidth && !this.gridLayout) { - this.setColWidths(); - } - if (this.alternateBgs) { - //1st time only if no paging and rememberGridValues - var AlternateRows = require("modules/alternateRows").AlternateRows; - this.Cpt.alternateRows = new AlternateRows(this); - this.Cpt.alternateRows.init(); - } - if (this.hasColOperation) { - var ColOps = require("modules/colOps").ColOps; - this.Cpt.colOps = new ColOps(this); - this.Cpt.colOps.calc(); - } - if (this.sort || this.gridLayout) { - this.SetSort(); - } - if (this.selectable || this.editable) { - this.SetEditable(); - } - - this.isFirstLoad = false; - this._hasGrid = true; - - if (this.rememberGridValues || this.rememberPageLen || this.rememberPageNb) { - this.resetValues(); - } - - //TF css class is added to table - if (!this.gridLayout) { - dom.addClass(this.tbl, this.prfxTf); - } - - if (this.loader) { - this.Cpt.loader.show("none"); - } - - /* Loads extensions */ - if (this.hasExtensions) { - this.LoadExtensions(); - } - - if (this.onFiltersLoaded) { - this.onFiltersLoaded.call(null, this); - } - } - }, - EvtManager: { - writable: true, - value: function (evt, s) { - var o = this; - var slcIndex = s && s.slcIndex !== undefined ? s.slcIndex : null; - var slcExternal = s && s.slcExternal !== undefined ? s.slcExternal : false; - var slcId = s && s.slcId !== undefined ? s.slcId : null; - var pgIndex = s && s.pgIndex !== undefined ? s.pgIndex : null; - - function efx() { - if (!evt) { - return; - } - switch (evt) { - case o.Evt.name.filter: - if (o.isModFilterFn) { - o.modFilterFn.call(null, o); - } else { - o._filter(); - } - break; - case o.Evt.name.dropdown: - if (o.linkedFilters) { - o.Cpt.dropdown._build(slcIndex, true); - } else { - o.Cpt.dropdown._build(slcIndex, false, slcExternal, slcId); - } - break; - case o.Evt.name.checklist: - o.Cpt.checkList._build(slcIndex, slcExternal, slcId); - break; - case o.Evt.name.changepage: - o.Cpt.paging._changePage(pgIndex); - break; - case o.Evt.name.clear: - o._clearFilters(); - o._filter(); - break; - case o.Evt.name.changeresultsperpage: - o.Cpt.paging._changeResultsPerPage(); - break; - case o.Evt.name.resetvalues: - o._resetValues(); - o._filter(); - break; - case o.Evt.name.resetpage: - o.Cpt.paging._resetPage(o.pgNbCookie); - break; - case o.Evt.name.resetpagelength: - o.Cpt.paging._resetPageLength(o.pgLenCookie); - break; - case o.Evt.name.sort: - void (0); - break; - case o.Evt.name.loadextensions: - o._LoadExtensions(); - break; - case o.Evt.name.loadthemes: - o._LoadThemes(); - break; - default: //to be used by extensions events when needed - o["_" + evt].call(null, o, s); - break; - } - if (o.statusBar) { - o.Cpt.statusBar.message(""); - } - if (o.loader) { - o.Cpt.loader.show("none"); - } - } - - if (this.loader || this.statusBar) { - try { - this.Cpt.loader.show(""); - // this.StatusMsg(o['msg'+evt]); - this.Cpt.statusBar.message(this["msg" + evt]); - } catch (e) {} - global.setTimeout(efx, this.execDelay); - } else { - efx(); - } - } - }, - ImportModule: { - writable: true, - value: function (module) { - if (!module.path || !module.name) { - return; - } - this.includeFile(module.name, module.path, module.init); - } - }, - LoadExtensions: { - writable: true, - value: function () { - if (!this.Ext) { - /*** TF extensions ***/ - var o = this; - this.Ext = { - list: {}, - add: function (extName, extDesc, extPath, extCallBack) { - var file = extPath.split("/")[extPath.split("/").length - 1], re = new RegExp(file), path = extPath.replace(re, ""); - o.Ext.list[extName] = { - name: extName, - description: extDesc, - file: file, - path: path, - callback: extCallBack - }; - } - }; - } - this.EvtManager(this.Evt.name.loadextensions); - } - }, - _LoadExtensions: { - writable: true, - value: function () { - if (!this.hasExtensions || !types.isArray(this.extensions.name) || !types.isArray(this.extensions.src)) { - return; - } - var ext = this.extensions; - for (var e = 0; e < ext.name.length; e++) { - var extPath = ext.src[e], extName = ext.name[e], extInit = (ext.initialize && ext.initialize[e]) ? ext.initialize[e] : null, extDesc = (ext.description && ext.description[e]) ? ext.description[e] : null; - - //Registers extension - this.Ext.add(extName, extDesc, extPath, extInit); - if (this.isImported(extPath)) { - extInit.call(null, this); - } else { - this.includeFile(extName, extPath, extInit); - } - } - } - }, - LoadThemes: { - writable: true, - value: function () { - this.EvtManager(this.Evt.name.loadthemes); - } - }, - _LoadThemes: { - writable: true, - value: function () { - if (!this.hasThemes) { - return; - } - if (!this.Thm) { - /*** TF themes ***/ - var o = this; - this.Thm = { - list: {}, - add: function (thmName, thmDesc, thmPath, thmCallBack) { - var file = thmPath.split("/")[thmPath.split("/").length - 1], re = new RegExp(file), path = thmPath.replace(re, ""); - o.Thm.list[thmName] = { - name: thmName, - description: thmDesc, - file: file, - path: path, - callback: thmCallBack - }; - } - }; - } - - //Default theme config - if (this.enableDefaultTheme) { - this.themes = { - name: ["DefaultTheme"], - src: [this.themesPath + "Default/TF_Default.css"], - description: ["Default Theme"] - }; - this.Thm.add("DefaultTheme", this.themesPath + "Default/TF_Default.css", "Default Theme"); - } - if (types.isArray(this.themes.name) && types.isArray(this.themes.src)) { - var thm = this.themes; - for (var i = 0; i < thm.name.length; i++) { - var thmPath = thm.src[i], thmName = thm.name[i], thmInit = (thm.initialize && thm.initialize[i]) ? thm.initialize[i] : null, thmDesc = (thm.description && thm.description[i]) ? thm.description[i] : null; - - //Registers theme - this.Thm.add(thmName, thmDesc, thmPath, thmInit); - - if (!this.isImported(thmPath, "link")) { - this.includeFile(thmName, thmPath, null, "link"); - } - if (types.isFn(thmInit)) { - thmInit.call(null, this); - } - } - } - - //Some elements need to be overriden for theme - //Reset button - this.btnResetText = null; - this.btnResetHtml = ""; - - //Paging buttons - this.btnPrevPageHtml = ""; - this.btnNextPageHtml = ""; - this.btnFirstPageHtml = ""; - this.btnLastPageHtml = ""; - - //Loader - this.loader = true; - this.loaderHtml = "
"; - this.loaderText = null; - } - }, - remove: { - writable: true, - value: function () { - if (this.fltGrid && this._hasGrid) { - var rows = this.tbl.rows; - if (this.paging) { - this.Cpt.paging.destroy(); - } - if (this.statusBar) { - // this.RemoveStatusBar(); - this.Cpt.statusBar.destroy(); - } - if (this.rowsCounter) { - this.Cpt.rowsCounter.destroy(); - } - if (this.btnReset) { - // this.RemoveResetBtn(); - this.Cpt.clearButton.destroy(); - } - if (this.helpInstructions /*|| !this.helpInstructions*/) { - this.Cpt.help.destroy(); - } - if (this.isExternalFlt && !this.popUpFilters) { - this.RemoveExternalFlts(); - } - if (this.infDiv) { - this.removeToolbar(); - } - if (this.highlightKeywords) { - this.Cpt.highlightKeyword.unhighlightAll(); - } - if (this.sort) { - this.RemoveSort(); - } - if (this.loader) { - this.Cpt.loader.remove(); - } - if (this.popUpFilters) { - this.Cpt.popupFilter.destroy(); - } - if (this.markActiveColumns) { - this.clearActiveColumns(); - } - if (this.editable || this.selectable) { - this.RemoveEditable(); - } - //this loop shows all rows and removes validRow attribute - for (var j = this.refRow; j < this.nbRows; j++) { - rows[j].style.display = ""; - try { - if (rows[j].hasAttribute("validRow")) { - rows[j].removeAttribute("validRow"); - } - } catch (e) { - //ie<=6 doesn't support hasAttribute method - var row = rows[j]; - var attribs = row.attributes; - for (var x = 0; x < attribs.length; x++) { - if (str.lower(attribs.nodeName) === "validrow") { - row.removeAttribute("validRow"); - } - } - } - - //removes alternating colors - if (this.alternateBgs) { - this.Cpt.alternateRows.removeRowBg(j); - } - } //for j - - if (this.fltGrid && !this.gridLayout) { - this.fltGridEl = rows[this.filtersRowIndex]; - this.tbl.deleteRow(this.filtersRowIndex); - } - if (this.gridLayout) { - this.Cpt.gridLayout.destroy(); - } - dom.removeClass(this.tbl, this.prfxTf); - this.activeFlt = null; - this.isStartBgAlternate = true; - this._hasGrid = false; - this.tbl = null; - } //if this.fltGrid - } - }, - setToolbar: { - writable: true, - value: function () { - if (this.infDiv !== null) { - return; - } - - /*** container div ***/ - var infdiv = dom.create("div", ["id", this.prfxInfDiv + this.id]); - infdiv.className = this.infDivCssClass; - - //custom container - if (this.toolBarTgtId) { - dom.id(this.toolBarTgtId).appendChild(infdiv); - } - //grid-layout - else if (this.gridLayout) { - this.Cpt.gridLayout.tblMainCont.appendChild(infdiv); - infdiv.className = this.gridInfDivCssClass; - } - //default location: just above the table - else { - this.tbl.parentNode.insertBefore(infdiv, this.tbl); - } - this.infDiv = dom.id(this.prfxInfDiv + this.id); - - /*** left div containing rows # displayer ***/ - var ldiv = dom.create("div", ["id", this.prfxLDiv + this.id]); - ldiv.className = this.lDivCssClass; - infdiv.appendChild(ldiv); - this.lDiv = dom.id(this.prfxLDiv + this.id); - - /*** right div containing reset button - + nb results per page select ***/ - var rdiv = dom.create("div", ["id", this.prfxRDiv + this.id]); - rdiv.className = this.rDivCssClass; - infdiv.appendChild(rdiv); - this.rDiv = dom.id(this.prfxRDiv + this.id); - - /*** mid div containing paging elements ***/ - var mdiv = dom.create("div", ["id", this.prfxMDiv + this.id]); - mdiv.className = this.mDivCssClass; - infdiv.appendChild(mdiv); - this.mDiv = dom.id(this.prfxMDiv + this.id); - - // Enable help instructions by default is topbar is generated - if (!this.helpInstructions) { - if (!this.Cpt.help) { - var Help = require("modules/help").Help; - this.Cpt.help = new Help(this); - } - this.Cpt.help.init(); - } - } - }, - removeToolbar: { - writable: true, - value: function () { - if (!this.infDiv) { - return; - } - this.infDiv.parentNode.removeChild(this.infDiv); - this.infDiv = null; - } - }, - RemoveExternalFlts: { - writable: true, - value: function () { - if (!this.isExternalFlt && !this.externalFltTgtIds) { - return; - } - for (var ct = 0; ct < this.externalFltTgtIds.length; ct++) { - var externalFltTgtId = this.externalFltTgtIds[ct], externalFlt = dom.id(externalFltTgtId); - if (externalFlt) { - externalFlt.innerHTML = ""; - } - } - } - }, - SetSort: { - writable: true, - value: function () { - var fn = this.Evt._EnableSort, sortConfig = this.sortConfig; - - if (!types.isFn(fn)) { - var o = this; - /*==================================================== - - enables table sorting - =====================================================*/ - this.Evt._EnableSort = function () { - //gridLayout needs sort to be re-enabled - if (o.isSortEnabled && !o.gridLayout) { - return; - } - if (this.isImported(sortConfig.adapterSrc)) { - sortConfig.initialize.call(null, o); - } else { - o.includeFile(sortConfig.name + "_adapter", sortConfig.adapterSrc, function () { - sortConfig.initialize.call(null, o); - }); - } - }; - } - - if (this.isImported(this.sortConfig.src)) { - this.Evt._EnableSort(); - } else { - this.includeFile(sortConfig.name, sortConfig.src, this.Evt._EnableSort); - } - } - }, - RemoveSort: { - writable: true, - value: function () { - this.sort = false; - } - }, - Sort: { - writable: true, - value: function () { - this.EvtManager(this.Evt.name.sort); - } - }, - SetEditable: { - writable: true, - value: function () { - var ezEditConfig = this.ezEditTableConfig; - if (this.isImported(ezEditConfig.src)) { - this._EnableEditable(); - } else { - this.includeFile(ezEditConfig.name, ezEditConfig.src, this._EnableEditable); - } - if (ezEditConfig.loadStylesheet && !this.isImported(ezEditConfig.stylesheet, "link")) { - this.includeFile(ezEditConfig.stylesheetName, ezEditConfig.stylesheet, null, "link"); - } - } - }, - RemoveEditable: { - writable: true, - value: function () { - var ezEditTable = this.ezEditTable; - if (ezEditTable) { - if (this.selectable) { - ezEditTable.Selection.ClearSelections(); - ezEditTable.Selection.Remove(); - } - if (this.editable) { - ezEditTable.Editable.Remove(); - } - } - } - }, - ResetEditable: { - writable: true, - value: function () { - var ezEditTable = this.ezEditTable; - if (ezEditTable) { - if (this.selectable) { - ezEditTable.Selection.Set(); - } - if (this.editable) { - ezEditTable.Editable.Set(); - } - } - } - }, - _EnableEditable: { - writable: true, - value: function (o) { - if (!o) { - o = this; - } - - //start row for EditTable constructor needs to be calculated - var startRow, ezEditConfig = o.ezEditTableConfig, thead = dom.tag(o.tbl, "thead"); - - //if thead exists and startRow not specified, startRow is calculated - //automatically by EditTable - if (thead.length > 0 && !ezEditConfig.startRow) { - startRow = undefined; - } - //otherwise startRow config property if any or TableFilter refRow - else { - startRow = ezEditConfig.startRow || o.refRow; - } - - ezEditConfig.scroll_into_view = ezEditConfig.scroll_into_view === false ? false : true; - ezEditConfig.base_path = ezEditConfig.base_path || o.basePath + "ezEditTable/"; - ezEditConfig.editable = o.editable = o.cfg.editable; - ezEditConfig.selection = o.selectable = o.cfg.selectable; - - if (o.selectable) { - ezEditConfig.default_selection = ezEditConfig.default_selection || "row"; - } - //CSS Styles - ezEditConfig.active_cell_css = ezEditConfig.active_cell_css || "ezETSelectedCell"; - - o._lastValidRowIndex = 0; - o._lastRowIndex = 0; - - if (o.selectable) { - //Row navigation needs to be calculated according to TableFilter's - //validRowsIndex array - var onAfterSelection = function (et, selectedElm, e) { - //table is not filtered - if (!o.validRowsIndex) { - return; - } - var validIndexes = o.validRowsIndex, validIdxLen = validIndexes.length, row = et.defaultSelection !== "row" ? selectedElm.parentNode : selectedElm, - //cell for default_selection = 'both' or 'cell' - cell = selectedElm.nodeName === "TD" ? selectedElm : null, keyCode = e !== undefined ? et.Event.GetKey(e) : 0, isRowValid = array.has(validIndexes, row.rowIndex), nextRowIndex, - //pgup/pgdown keys - d = (keyCode === 34 || keyCode === 33 ? (o.pagingLength || et.nbRowsPerPage) : 1); - - //If next row is not valid, next valid filtered row needs to be - //calculated - if (!isRowValid) { - //Selection direction up/down - if (row.rowIndex > o._lastRowIndex) { - //last row - if (row.rowIndex >= validIndexes[validIdxLen - 1]) { - nextRowIndex = validIndexes[validIdxLen - 1]; - } else { - var calcRowIndex = (o._lastValidRowIndex + d); - if (calcRowIndex > (validIdxLen - 1)) { - nextRowIndex = validIndexes[validIdxLen - 1]; - } else { - nextRowIndex = validIndexes[calcRowIndex]; - } - } - } else { - //first row - if (row.rowIndex <= validIndexes[0]) { - nextRowIndex = validIndexes[0]; - } else { - var v = validIndexes[o._lastValidRowIndex - d]; - nextRowIndex = v ? v : validIndexes[0]; - } - } - o._lastRowIndex = row.rowIndex; - DoSelection(nextRowIndex); - } else { - //If filtered row is valid, special calculation for - //pgup/pgdown keys - if (keyCode !== 34 && keyCode !== 33) { - o._lastValidRowIndex = array.indexByValue(validIndexes, row.rowIndex); - o._lastRowIndex = row.rowIndex; - } else { - if (keyCode === 34) { - //pgdown - //last row - if ((o._lastValidRowIndex + d) <= (validIdxLen - 1)) { - nextRowIndex = validIndexes[o._lastValidRowIndex + d]; - } else { - nextRowIndex = [validIdxLen - 1]; - } - } else { - //pgup - //first row - if ((o._lastValidRowIndex - d) <= validIndexes[0]) { - nextRowIndex = validIndexes[0]; - } else { - nextRowIndex = validIndexes[o._lastValidRowIndex - d]; - } - } - o._lastRowIndex = nextRowIndex; - o._lastValidRowIndex = array.indexByValue(validIndexes, nextRowIndex); - DoSelection(nextRowIndex); - } - } - - //Next valid filtered row needs to be selected - var DoSelection = function (nextRowIndex) { - if (et.defaultSelection === "row") { - et.Selection.SelectRowByIndex(nextRowIndex); - } else { - et.ClearSelections(); - var cellIndex = selectedElm.cellIndex, row = o.tbl.rows[nextRowIndex]; - if (et.defaultSelection === "both") { - et.Selection.SelectRowByIndex(nextRowIndex); - } - if (row) { - et.Selection.SelectCell(row.cells[cellIndex]); - } - } - //Table is filtered - if (o.validRowsIndex.length !== o.getRowsNb()) { - var r = o.tbl.rows[nextRowIndex]; - if (r) { - r.scrollIntoView(false); - } - if (cell) { - if (cell.cellIndex === (o.getCellsNb() - 1) && o.gridLayout) { - o.tblCont.scrollLeft = 100000000; - } else if (cell.cellIndex === 0 && o.gridLayout) { - o.tblCont.scrollLeft = 0; - } else { - cell.scrollIntoView(false); - } - } - } - }; - }; - - //Page navigation has to be enforced whenever selected row is out of - //the current page range - var onBeforeSelection = function (et, selectedElm, e) { - var row = et.defaultSelection !== "row" ? selectedElm.parentNode : selectedElm; - if (o.paging) { - if (o.nbPages > 1) { - //page length is re-assigned in case it has changed - et.nbRowsPerPage = o.pagingLength; - var validIndexes = o.validRowsIndex, validIdxLen = validIndexes.length, pagingEndRow = parseInt(o.startPagingRow, 10) + parseInt(o.pagingLength, 10); - var rowIndex = row.rowIndex; - if ((rowIndex === validIndexes[validIdxLen - 1]) && o.currentPageNb != o.nbPages) { - // o.SetPage('last'); - o.Cpt.paging.setPage("last"); - } else if ((rowIndex == validIndexes[0]) && o.currentPageNb !== 1) { - // o.SetPage('first'); - o.Cpt.paging.setPage("first"); - } else if (rowIndex > validIndexes[pagingEndRow - 1] && rowIndex < validIndexes[validIdxLen - 1]) { - // o.SetPage('next'); - o.Cpt.paging.setPage("next"); - } else if (rowIndex < validIndexes[o.startPagingRow] && rowIndex > validIndexes[0]) { - // o.SetPage('previous'); - o.Cpt.paging.setPage("previous"); - } - } - } - }; - - //Selected row needs to be visible when paging is activated - if (o.paging) { - o.onAfterChangePage = function (tf, i) { - var et = tf.ezEditTable; - var row = et.Selection.GetActiveRow(); - if (row) { - row.scrollIntoView(false); - } - var cell = et.Selection.GetActiveCell(); - if (cell) { - cell.scrollIntoView(false); - } - }; - } - - //Rows navigation when rows are filtered is performed with the - //EditTable row selection callback events - if (ezEditConfig.default_selection === "row") { - var fnB = ezEditConfig.on_before_selected_row; - ezEditConfig.on_before_selected_row = function () { - onBeforeSelection(arguments[0], arguments[1], arguments[2]); - if (fnB) { - fnB.call(null, arguments[0], arguments[1], arguments[2]); - } - }; - var fnA = ezEditConfig.on_after_selected_row; - ezEditConfig.on_after_selected_row = function () { - onAfterSelection(arguments[0], arguments[1], arguments[2]); - if (fnA) { - fnA.call(null, arguments[0], arguments[1], arguments[2]); - } - }; - } else { - var fnD = ezEditConfig.on_before_selected_cell; - ezEditConfig.on_before_selected_cell = function () { - onBeforeSelection(arguments[0], arguments[1], arguments[2]); - if (fnD) { - fnD.call(null, arguments[0], arguments[1], arguments[2]); - } - }; - var fnC = ezEditConfig.on_after_selected_cell; - ezEditConfig.on_after_selected_cell = function () { - onAfterSelection(arguments[0], arguments[1], arguments[2]); - if (fnC) { - fnC.call(null, arguments[0], arguments[1], arguments[2]); - } - }; - } - } - if (o.editable) { - //Added or removed rows, TF rows number needs to be re-calculated - var fnE = ezEditConfig.on_added_dom_row; - ezEditConfig.on_added_dom_row = function () { - o.nbFilterableRows++; - if (!o.paging) { - o.Cpt.rowsCounter.refresh(); - } else { - o.nbRows++; - o.nbVisibleRows++; - o.nbFilterableRows++; - o.paging = false; - o.Cpt.paging.destroy(); - o.Cpt.paging.addPaging(); - } - if (o.alternateBgs) { - o.Cpt.alternateRows.init(); - } - if (fnE) { - fnE.call(null, arguments[0], arguments[1], arguments[2]); - } - }; - if (ezEditConfig.actions && ezEditConfig.actions["delete"]) { - var fnF = ezEditConfig.actions["delete"].on_after_submit; - ezEditConfig.actions["delete"].on_after_submit = function () { - o.nbFilterableRows--; - if (!o.paging) { - o.Cpt.rowsCounter.refresh(); - } else { - o.nbRows--; - o.nbVisibleRows--; - o.nbFilterableRows--; - o.paging = false; - o.Cpt.paging.destroy(); - o.Cpt.paging.addPaging(false); - } - if (o.alternateBgs) { - o.Cpt.alternateRows.init(); - } - if (fnF) { - fnF.call(null, arguments[0], arguments[1]); - } - }; - } - } - - try { - o.ezEditTable = new EditTable(o.id, ezEditConfig, startRow); - o.ezEditTable.Init(); - } catch (e) { - console.log(ezEditConfig.err); - } - } - }, - resetValues: { - writable: true, - value: function () { - this.EvtManager(this.Evt.name.resetvalues); - } - }, - _resetValues: { - writable: true, - value: function () { - //only fillSlcOnDemand - if (this.rememberGridValues && this.fillSlcOnDemand) { - this.resetGridValues(this.fltsValuesCookie); - } - if (this.rememberPageLen) { - // this.ResetPageLength(this.pgLenCookie); - this.Cpt.paging.resetPageLength(this.pgLenCookie); - } - if (this.rememberPageNb) { - // this.ResetPage(this.pgNbCookie); - this.Cpt.paging.resetPage(this.pgNbCookie); - } - } - }, - resetGridValues: { - writable: true, - value: function (name) { - if (!this.fillSlcOnDemand) { - return; - } - var fltsValues = this.Cpt.store.getFilterValues(name), slcFltsIndex = this.getFiltersByType(this.fltTypeSlc, true), multiFltsIndex = this.getFiltersByType(this.fltTypeMulti, true); - - //if the number of columns is the same as before page reload - if (Number(fltsValues[(fltsValues.length - 1)]) === this.fltIds.length) { - for (var i = 0; i < (fltsValues.length - 1); i++) { - if (fltsValues[i] === " ") { - continue; - } - var s, opt; - // if fillSlcOnDemand, drop-down needs to contain stored - // value(s) for filtering - if (this["col" + i] === this.fltTypeSlc || this["col" + i] === this.fltTypeMulti) { - var slc = dom.id(this.fltIds[i]); - slc.options[0].selected = false; - - //selects - if (array.has(slcFltsIndex, i)) { - opt = dom.createOpt(fltsValues[i], fltsValues[i], true); - slc.appendChild(opt); - this.hasStoredValues = true; - } - //multiple select - if (array.has(multiFltsIndex, i)) { - s = fltsValues[i].split(" " + this.orOperator + " "); - for (j = 0; j < s.length; j++) { - if (s[j] === "") { - continue; - } - opt = dom.createOpt(s[j], s[j], true); - slc.appendChild(opt); - this.hasStoredValues = true; - - // IE multiple selection work-around - // if(hlp.isIE()){ - // this.__deferMultipleSelection(slc,j,false); - // hasStoredValues = false; - // } - } - } // if multiFltsIndex - } else if (this["col" + i] == this.fltTypeCheckList) { - var checkList = this.Cpt.checkList; - var divChk = checkList.checkListDiv[i]; - divChk.title = divChk.innerHTML; - divChk.innerHTML = ""; - - var ul = dom.create("ul", ["id", this.fltIds[i]], ["colIndex", i]); - ul.className = checkList.checkListCssClass; - - var li0 = dom.createCheckItem(this.fltIds[i] + "_0", "", this.displayAllText); - li0.className = checkList.checkListItemCssClass; - ul.appendChild(li0); - - divChk.appendChild(ul); - - s = fltsValues[i].split(" " + this.orOperator + " "); - for (j = 0; j < s.length; j++) { - if (s[j] === "") { - continue; - } - var li = dom.createCheckItem(this.fltIds[i] + "_" + (j + 1), s[j], s[j]); - li.className = checkList.checkListItemCssClass; - ul.appendChild(li); - li.check.checked = true; - checkList.setCheckListValues(li.check); - this.hasStoredValues = true; - } - } - } //end for - - if (!this.hasStoredValues && this.paging) { - this.Cpt.paging.setPagingInfo(); - } - } //end if - } - }, - filter: { - writable: true, - value: function () { - this.EvtManager(this.Evt.name.filter); - } - }, - _filter: { - writable: true, - value: function () { - if (!this.fltGrid || (!this._hasGrid && !this.isFirstLoad)) { - return; - } - //invokes onbefore callback - if (this.onBeforeFilter) { - this.onBeforeFilter.call(null, this); - } - - var row = this.tbl.rows, f = this.cfg, hiddenrows = 0; - this.validRowsIndex = []; - var o = this; - - // removes keyword highlighting - if (this.highlightKeywords) { - this.Cpt.highlightKeyword.unhighlightAll(); - } - //removes popup filters active icons - if (this.popUpFilters) { - this.Cpt.popupFilter.buildIcons(); - } - //removes active column header class - if (this.markActiveColumns) { - this.clearActiveColumns(); - } - // search args re-init - this.searchArgs = this.getFiltersValue(); - - var num_cell_data, nbFormat; - var re_le = new RegExp(this.leOperator), re_ge = new RegExp(this.geOperator), re_l = new RegExp(this.lwOperator), re_g = new RegExp(this.grOperator), re_d = new RegExp(this.dfOperator), re_lk = new RegExp(str.rgxEsc(this.lkOperator)), re_eq = new RegExp(this.eqOperator), re_st = new RegExp(this.stOperator), re_en = new RegExp(this.enOperator), re_an = new RegExp(this.anOperator), re_cr = new RegExp(this.curExp), re_em = this.emOperator, re_nm = this.nmOperator, re_re = new RegExp(str.rgxEsc(this.rgxOperator)); - - //keyword highlighting - function highlight(str, ok, cell) { - if (o.highlightKeywords && ok) { - str = str.replace(re_lk, ""); - str = str.replace(re_eq, ""); - str = str.replace(re_st, ""); - str = str.replace(re_en, ""); - var w = str; - if (re_le.test(str) || re_ge.test(str) || re_l.test(str) || re_g.test(str) || re_d.test(str)) { - w = dom.getText(cell); - } - if (w !== "") { - o.Cpt.highlightKeyword.highlight(cell, w, o.Cpt.highlightKeyword.highlightCssClass); - } - } - } - - //looks for search argument in current row - function hasArg(sA, cell_data, j) { - var occurence; - //Search arg operator tests - var hasLO = re_l.test(sA), hasLE = re_le.test(sA), hasGR = re_g.test(sA), hasGE = re_ge.test(sA), hasDF = re_d.test(sA), hasEQ = re_eq.test(sA), hasLK = re_lk.test(sA), hasAN = re_an.test(sA), hasST = re_st.test(sA), hasEN = re_en.test(sA), hasEM = (re_em === sA), hasNM = (re_nm === sA), hasRE = re_re.test(sA); - - //Search arg dates tests - var isLDate = hasLO && isValidDate(sA.replace(re_l, ""), dtType); - var isLEDate = hasLE && isValidDate(sA.replace(re_le, ""), dtType); - var isGDate = hasGR && isValidDate(sA.replace(re_g, ""), dtType); - var isGEDate = hasGE && isValidDate(sA.replace(re_ge, ""), dtType); - var isDFDate = hasDF && isValidDate(sA.replace(re_d, ""), dtType); - var isEQDate = hasEQ && isValidDate(sA.replace(re_eq, ""), dtType); - - var dte1, dte2; - //dates - if (isValidDate(cell_data, dtType)) { - dte1 = formatDate(cell_data, dtType); - // lower date - if (isLDate) { - dte2 = formatDate(sA.replace(re_l, ""), dtType); - occurence = dte1 < dte2; - } - // lower equal date - else if (isLEDate) { - dte2 = formatDate(sA.replace(re_le, ""), dtType); - occurence = dte1 <= dte2; - } - // greater equal date - else if (isGEDate) { - dte2 = formatDate(sA.replace(re_ge, ""), dtType); - occurence = dte1 >= dte2; - } - // greater date - else if (isGDate) { - dte2 = formatDate(sA.replace(re_g, ""), dtType); - occurence = dte1 > dte2; - } - // different date - else if (isDFDate) { - dte2 = formatDate(sA.replace(re_d, ""), dtType); - occurence = dte1.toString() != dte2.toString(); - } - // equal date - else if (isEQDate) { - dte2 = formatDate(sA.replace(re_eq, ""), dtType); - occurence = dte1.toString() == dte2.toString(); - } - // searched keyword with * operator doesn't have to be a date - else if (re_lk.test(sA)) { - // like date - occurence = o._containsStr(sA.replace(re_lk, ""), cell_data, null, false); - } else if (isValidDate(sA, dtType)) { - dte2 = formatDate(sA, dtType); - occurence = dte1.toString() == dte2.toString(); - } - //empty - else if (hasEM) { - occurence = str.isEmpty(cell_data); - } - //non-empty - else if (hasNM) { - occurence = !str.isEmpty(cell_data); - } - } else { - //first numbers need to be formated - if (o.hasColNbFormat && o.colNbFormat[j]) { - num_cell_data = removeNbFormat(cell_data, o.colNbFormat[j]); - nbFormat = o.colNbFormat[j]; - } else { - if (o.thousandsSeparator === "," && o.decimalSeparator === ".") { - num_cell_data = removeNbFormat(cell_data, "us"); - nbFormat = "us"; - } else { - num_cell_data = removeNbFormat(cell_data, "eu"); - nbFormat = "eu"; - } - } - - // first checks if there is any operator (<,>,<=,>=,!,*,=,{,}, - // rgx:) - // lower equal - if (hasLE) { - occurence = num_cell_data <= removeNbFormat(sA.replace(re_le, ""), nbFormat); - } - //greater equal - else if (hasGE) { - occurence = num_cell_data >= removeNbFormat(sA.replace(re_ge, ""), nbFormat); - } - //lower - else if (hasLO) { - occurence = num_cell_data < removeNbFormat(sA.replace(re_l, ""), nbFormat); - } - //greater - else if (hasGR) { - occurence = num_cell_data > removeNbFormat(sA.replace(re_g, ""), nbFormat); - } - //different - else if (hasDF) { - occurence = o._containsStr(sA.replace(re_d, ""), cell_data) ? false : true; - } - //like - else if (hasLK) { - occurence = o._containsStr(sA.replace(re_lk, ""), cell_data, null, false); - } - //equal - else if (hasEQ) { - occurence = o._containsStr(sA.replace(re_eq, ""), cell_data, null, true); - } - //starts with - else if (hasST) { - occurence = cell_data.indexOf(sA.replace(re_st, "")) === 0 ? true : false; - } - //ends with - else if (hasEN) { - var searchArg = sA.replace(re_en, ""); - occurence = cell_data.lastIndexOf(searchArg, cell_data.length - 1) === (cell_data.length - 1) - (searchArg.length - 1) && cell_data.lastIndexOf(searchArg, cell_data.length - 1) > -1 ? true : false; - } - //empty - else if (hasEM) { - occurence = str.isEmpty(cell_data); - } - //non-empty - else if (hasNM) { - occurence = !str.isEmpty(cell_data); - } - //regexp - else if (hasRE) { - //in case regexp fires an exception - try { - //operator is removed - var srchArg = sA.replace(re_re, ""); - var rgx = new RegExp(srchArg); - occurence = rgx.test(cell_data); - } catch (e) { - occurence = false; - } - } else { - var fCol = f["col_" + j]; - occurence = o._containsStr(sA, cell_data, !fCol ? this.fltTypeInp : fCol); - } - } //else - return occurence; - } //fn - - for (var k = this.refRow; k < this.nbRows; k++) { - /*** if table already filtered some rows are not visible ***/ - if (row[k].style.display === "none") { - row[k].style.display = ""; - } - - var cell = row[k].cells, nchilds = cell.length; - - // checks if row has exact cell # - if (nchilds !== this.nbCells) { - continue; - } - - var occurence = [], isRowValid = this.searchType === "include" ? true : false, - //only for single filter search - singleFltRowValid = false; - - // this loop retrieves cell data - for (var j = 0; j < nchilds; j++) { - //searched keyword - var sA = this.searchArgs[this.singleSearchFlt ? 0 : j], dtType = this.hasColDateType ? this.colDateType[j] : this.defaultDateType; - if (sA === "") { - continue; - } - - var cell_data = str.matchCase(this.getCellData(j, cell[j]), this.matchCase); - - //multiple search parameter operator || - var sAOrSplit = sA.split(this.orOperator), - //multiple search || parameter boolean - hasMultiOrSA = (sAOrSplit.length > 1) ? true : false, - //multiple search parameter operator && - sAAndSplit = sA.split(this.anOperator), - //multiple search && parameter boolean - hasMultiAndSA = sAAndSplit.length > 1 ? true : false; - - //multiple sarch parameters - if (hasMultiOrSA || hasMultiAndSA) { - var cS, occur = false, s = hasMultiOrSA ? sAOrSplit : sAAndSplit; - for (var w = 0; w < s.length; w++) { - cS = str.trim(s[w]); - occur = hasArg(cS, cell_data, j); - highlight(cS, occur, cell[j]); - if (hasMultiOrSA && occur) { - break; - } - if (hasMultiAndSA && !occur) { - break; - } - } - occurence[j] = occur; - } - //single search parameter - else { - occurence[j] = hasArg(str.trim(sA), cell_data, j); - highlight(sA, occurence[j], cell[j]); - } //else single param - - if (!occurence[j]) { - isRowValid = this.searchType === "include" ? false : true; - } - if (this.singleSearchFlt && occurence[j]) { - singleFltRowValid = true; - } - if (this.popUpFilters) { - this.Cpt.popupFilter.buildIcon(j, true); - } - if (this.markActiveColumns) { - if (k === this.refRow) { - if (this.onBeforeActiveColumn) { - this.onBeforeActiveColumn.call(null, this, j); - } - dom.addClass(this.getHeaderElement(j), this.activeColumnsCssClass); - if (this.onAfterActiveColumn) { - this.onAfterActiveColumn.call(null, this, j); - } - } - } - } //for j - - if (this.singleSearchFlt && singleFltRowValid) { - isRowValid = true; - } - - if (!isRowValid) { - this.validateRow(k, false); - // always visible rows need to be counted as valid - if (this.hasVisibleRows && array.has(this.visibleRows, k) && !this.paging) { - this.validRowsIndex.push(k); - } else { - hiddenrows++; - } - } else { - this.validateRow(k, true); - this.validRowsIndex.push(k); - if (this.alternateBgs) { - this.Cpt.alternateRows.setRowBg(k, this.validRowsIndex.length); - } - if (this.onRowValidated) { - this.onRowValidated.call(null, this, k); - } - } - } // for k - - this.nbVisibleRows = this.validRowsIndex.length; - this.nbHiddenRows = hiddenrows; - this.isStartBgAlternate = false; - - if (this.rememberGridValues) { - this.Cpt.store.saveFilterValues(this.fltsValuesCookie); - } - //applies filter props after filtering process - if (!this.paging) { - this.applyGridProps(); - } else { - this.startPagingRow = 0; - this.currentPageNb = 1; - this.Cpt.paging.setPagingInfo(this.validRowsIndex); - } //starts paging process - //invokes onafter callback - if (this.onAfterFilter) { - this.onAfterFilter.call(null, this); - } - } - }, - applyGridProps: { - writable: true, - value: function () { - // blurs active filter (IE) - if (this.activeFlt && str.lower(this.activeFlt.nodeName) === this.fltTypeSlc && !this.popUpFilters) { - this.activeFlt.blur(); - if (this.activeFlt.parentNode) { - this.activeFlt.parentNode.focus(); - } - } - - //shows rows always visible - if (this.visibleRows) { - this.enforceVisibility(); - } - //makes operation on a col - if (this.hasColOperation) { - this.Cpt.colOps.calc(); - } - //re-populates drop-down filters - if (this.linkedFilters) { - this.linkFilters(); - } - var nr = !this.paging && this.hasVisibleRows ? this.nbVisibleRows - this.visibleRows.length : this.nbVisibleRows; - //refreshes rows counter - if (this.rowsCounter) { - this.Cpt.rowsCounter.refresh(nr); - } - - if (this.popUpFilters) { - this.Cpt.popupFilter.closeAll(); - } - } - }, - getColValues: { - writable: true, - value: function (colindex, num, exclude) { - if (!this.fltGrid) { - return; - } - var row = this.tbl.rows, colValues = []; - - for (var i = this.refRow; i < this.nbRows; i++) { - var isExludedRow = false; - // checks if current row index appears in exclude array - if (exclude && types.isArray(exclude)) { - isExludedRow = array.has(exclude, i); //boolean - } - var cell = row[i].cells, nchilds = cell.length; - - // checks if row has exact cell # and is not excluded - if (nchilds == this.nbCells && !isExludedRow) { - // this loop retrieves cell data - for (var j = 0; j < nchilds; j++) { - if (j === colindex && row[i].style.display === "") { - var cell_data = str.lower(this.getCellData(j, cell[j])), nbFormat = this.colNbFormat ? this.colNbFormat[colindex] : null, data = num ? removeNbFormat(cell_data, nbFormat) : cell_data; - colValues.push(data); - } - } - } - } //for i - return colValues; - } - }, - getFilterValue: { - writable: true, - value: function (index) { - if (!this.fltGrid) { - return; - } - var fltValue, flt = this.getFilterElement(index); - if (!flt) { - return ""; - } - var fltColType = this.fltCol[index]; - if (fltColType !== this.fltTypeMulti && fltColType !== this.fltTypeCheckList) { - fltValue = flt.value; - } - //mutiple select - else if (fltColType === this.fltTypeMulti) { - fltValue = ""; - for (var j = 0; j < flt.options.length; j++) { - if (flt.options[j].selected) { - fltValue = fltValue.concat(flt.options[j].value + " " + this.orOperator + " "); - } - } - //removes last operator || - fltValue = fltValue.substr(0, fltValue.length - 4); - } - //checklist - else if (fltColType === this.fltTypeCheckList) { - if (flt.getAttribute("value") !== null) { - fltValue = flt.getAttribute("value"); - //removes last operator || - fltValue = fltValue.substr(0, fltValue.length - 3); - } else { - fltValue = ""; - } - } - return fltValue; - } - }, - getFiltersValue: { - writable: true, - value: function () { - if (!this.fltGrid) { - return; - } - var searchArgs = []; - for (var i = 0; i < this.fltIds.length; i++) { - searchArgs.push(str.trim(str.matchCase(this.getFilterValue(i), this.matchCase))); - } - return searchArgs; - } - }, - getFilterId: { - writable: true, - value: function (index) { - if (!this.fltGrid) { - return; - } - return this.fltIds[i]; - } - }, - getFiltersByType: { - writable: true, - value: function (type, bool) { - if (!this.fltGrid) { - return; - } - var arr = []; - for (var i = 0; i < this.fltIds.length; i++) { - var fltType = this["col" + i]; - if (fltType === str.lower(type)) { - var a = (bool) ? i : this.fltIds[i]; - arr.push(a); - } - } - return arr; - } - }, - getFilterElement: { - writable: true, - value: function (index) { - if (!this.fltGrid) { - return null; - } - return dom.id(this.fltIds[index]); - } - }, - getCellsNb: { - writable: true, - value: function (rowIndex) { - var tr = !rowIndex ? this.tbl.rows[0] : this.tbl.rows[rowIndex]; - return tr.cells.length; - } - }, - getRowsNb: { - writable: true, - value: function (includeHeaders) { - var s = !this.refRow ? 0 : this.refRow, ntrs = this.tbl.rows.length; - if (includeHeaders) { - s = 0; - } - return parseInt(ntrs - s, 10); - } - }, - getCellData: { - writable: true, - value: function (i, cell) { - if (i === undefined || !cell) { - return ""; - } - //First checks for customCellData event - if (this.customCellData && array.has(this.customCellDataCols, i)) { - return this.customCellData.call(null, this, cell, i); - } else { - return dom.getText(cell); - } - } - }, - getTableData: { - writable: true, - value: function () { - var row = this.tbl.rows; - for (var k = this.refRow; k < this.nbRows; k++) { - var rowData = [k, []]; - var cells = row[k].cells; - // this loop retrieves cell data - for (var j = 0; j < cells.length; j++) { - var cell_data = this.getCellData(j, cells[j]); - rowData[1].push(cell_data); - } - this.tblData.push(rowData); - } - return this.tblData; - } - }, - getFilteredData: { - writable: true, - value: function (includeHeaders) { - if (!this.validRowsIndex) { - return []; - } - var row = this.tbl.rows, filteredData = []; - if (includeHeaders) { - var table = this.gridLayout ? this.headTbl : this.tbl, r = table.rows[this.headersRow], rowData = [r.rowIndex, []]; - for (var j = 0; j < this.nbCells; j++) { - var headerText = this.getCellData(j, r.cells[j]); - rowData[1].push(headerText); - } - filteredData.push(rowData); - } - - var validRows = this.getValidRowsIndex(true); - for (var i = 0; i < validRows.length; i++) { - var rData = [this.validRowsIndex[i], []], cells = row[this.validRowsIndex[i]].cells; - for (var k = 0; k < cells.length; k++) { - var cell_data = this.getCellData(k, cells[k]); - rData[1].push(cell_data); - } - filteredData.push(rData); - } - return filteredData; - } - }, - getFilteredDataCol: { - writable: true, - value: function (colIndex) { - if (colIndex === undefined) { - return []; - } - var data = this.getFilteredData(), colData = []; - for (var i = 0; i < data.length; i++) { - var r = data[i], - //cols values of current row - d = r[1], - //data of searched column - c = d[colIndex]; - colData.push(c); - } - return colData; - } - }, - getRowDisplay: { - writable: true, - value: function (row) { - if (!this.fltGrid && !types.isObj(row)) { - return; - } - return row.style.display; - } - }, - validateRow: { - writable: true, - value: function (rowIndex, isValid) { - var row = this.tbl.rows[rowIndex]; - if (!row || str.lower(typeof isValid) !== "boolean") { - return; - } - - // always visible rows are valid - if (this.hasVisibleRows && array.has(this.visibleRows, rowIndex) && !this.paging) { - isValid = true; - } - - var displayFlag = isValid ? "" : "none", validFlag = isValid ? "true" : "false"; - row.style.display = displayFlag; - - if (this.paging) { - row.setAttribute("validRow", validFlag); - } - } - }, - validateAllRows: { - writable: true, - value: function () { - if (!this._hasGrid) { - return; - } - this.validRowsIndex = []; - for (var k = this.refRow; k < this.nbFilterableRows; k++) { - this.validateRow(k, true); - this.validRowsIndex.push(k); - } - } - }, - setFilterValue: { - writable: true, - value: function (index, searcharg, doFilter) { - if ((!this.fltGrid && !this.isFirstLoad) || !this.getFilterElement(index)) { - return; - } - var slc = this.getFilterElement(index), execFilter = doFilter === undefined ? true : doFilter, fltColType = this["col" + index]; - searcharg = searcharg === undefined ? "" : searcharg; - - if (fltColType !== this.fltTypeMulti && fltColType != this.fltTypeCheckList) { - slc.value = searcharg; - } - //multiple selects - else if (fltColType === this.fltTypeMulti) { - var s = searcharg.split(" " + this.orOperator + " "), ct = 0; //keywords counter - for (var j = 0; j < slc.options.length; j++) { - if (s === "" || s[0] === "") { - slc.options[j].selected = false; - } - if (slc.options[j].value === "") { - slc.options[j].selected = false; - } - if (slc.options[j].value !== "" && array.has(s, slc.options[j].value, true)) { - // IE multiple selection work-around - // if(hlp.isIE()){ - // //when last value reached filtering can be executed - // var filter = ct==(s.length-1) && execFilter ? - // true : false; - // this.__deferMultipleSelection(slc,j,filter); - // ct++; - // } - // else{ - // slc.options[j].selected = true; - // } - slc.options[j].selected = true; - } //if - } //for j - } - //checklist - else if (fltColType === this.fltTypeCheckList) { - searcharg = str.matchCase(searcharg, this.matchCase); - var sarg = searcharg.split(" " + this.orOperator + " "), fltValue = slc.setAttribute("value", ""), fltIndex = slc.setAttribute("indexes", ""); - for (var k = 0; k < dom.tag(slc, "li").length; k++) { - var li = dom.tag(slc, "li")[k], lbl = dom.tag(li, "label")[0], chk = dom.tag(li, "input")[0], lblTxt = str.matchCase(dom.getText(lbl), this.matchCase); - if (lblTxt !== "" && array.has(sarg, lblTxt, true)) { - chk.checked = true; - this.Cpt.checkList.setCheckListValues(chk); - } else { - chk.checked = false; - this.Cpt.checkList.setCheckListValues(chk); - } - } - } - } - }, - setColWidths: { - writable: true, - value: function (rowIndex) { - if (!this.fltGrid || !this.hasColWidth) { - return; - } - var o = this, rIndex; - if (rowIndex === undefined) { - rIndex = this.tbl.rows[0].style.display != "none" ? 0 : 1; - } else { - rIndex = rowIndex; - } - setWidths(this.tbl.rows[rIndex]); - - function setWidths(row) { - if (!o && (o.nbCells != o.colWidth.length)) { - return; - } - if (o.nbCells == row.cells.length) { - for (var k = 0; k < o.nbCells; k++) { - row.cells[k].style.width = o.colWidth[k]; - } - } - } - } - }, - enforceVisibility: { - writable: true, - value: function () { - if (this._hasGrid && this.hasVisibleRows && !this.paging) { - for (var i = 0; i < this.visibleRows.length; i++) { - //row index cannot be > nrows - if (this.visibleRows[i] <= this.nbRows) { - this.validateRow(this.visibleRows[i], true); - } - } - } - } - }, - clearFilters: { - writable: true, - value: function () { - this.EvtManager(this.Evt.name.clear); - } - }, - _clearFilters: { - writable: true, - value: function () { - if (!this.fltGrid) { - return; - } - if (this.onBeforeReset) { - this.onBeforeReset.call(null, this, this.getFiltersValue()); - } - for (var i = 0; i < this.fltIds.length; i++) { - this.setFilterValue(i, ""); - } - if (this.linkedFilters) { - this.activeFilterId = ""; - this.linkFilters(); - } - if (this.rememberPageLen) { - cookie.remove(this.pgLenCookie); - } - if (this.rememberPageNb) { - cookie.remove(this.pgNbCookie); - } - if (this.onAfterReset) { - this.onAfterReset.call(null, this); - } - } - }, - clearActiveColumns: { - writable: true, - value: function () { - for (var i = 0; i < this.fltIds.length; i++) { - dom.removeClass(this.getHeaderElement(i), this.activeColumnsCssClass); - } - } - }, - refresh: { - writable: true, - value: function (config) { - var configObj = !config ? this.cfg : config; - var hasSort = this.sort; - //sort property is set to false in order to avoid sort object - //re-instanciation - if (hasSort) { - this.sort = false; - } - this.nbRows = this.getRowsNb(); //in case table is refreshed - this.remove(); - window["tf_" + this.id] = new TableFilter(this.id, this.startRow, configObj); - this.isFirstLoad = true; - this.fltIds = []; - this.init(); - //New tbody content needs to be referenced in sortabletable script with - //setTBody() method - if (hasSort) { - //this.st = SortableTable object - //Note this is a method of the Sortable Table 1.12 script - //(Erik Arvidsson) - this.st.setTBody(this.tbl.tBodies[0]); - //finally sort property is enabled again - this.sort = true; - } - } - }, - linkFilters: { - writable: true, - value: function () { - var slcA1 = this.getFiltersByType(this.fltTypeSlc, true), slcA2 = this.getFiltersByType(this.fltTypeMulti, true), slcA3 = this.getFiltersByType(this.fltTypeCheckList, true), slcIndex = slcA1.concat(slcA2); - slcIndex = slcIndex.concat(slcA3); - - if (this.activeFilterId) { - var activeFlt = this.activeFilterId.split("_")[0]; - activeFlt = activeFlt.split(this.prfxFlt)[1]; - var slcSelectedValue; - for (var i = 0; i < slcIndex.length; i++) { - var curSlc = dom.id(this.fltIds[slcIndex[i]]); - slcSelectedValue = this.getFilterValue(slcIndex[i]); - if (activeFlt !== slcIndex[i] || (this.paging && array.has(slcA1, slcIndex[i]) && activeFlt === slcIndex[i]) || (!this.paging && (array.has(slcA3, slcIndex[i]) || array.has(slcA2, slcIndex[i]))) || slcSelectedValue === this.displayAllText) { - if (array.has(slcA3, slcIndex[i])) { - this.Cpt.checkList.checkListDiv[slcIndex[i]].innerHTML = ""; - } else { - curSlc.innerHTML = ""; - } - - //1st option needs to be inserted - if (this.fillSlcOnDemand) { - var opt0 = dom.createOpt(this.displayAllText, ""); - if (curSlc) { - curSlc.appendChild(opt0); - } - } - - if (array.has(slcA3, slcIndex[i])) { - this.Cpt.checkList._build(slcIndex[i]); - } else { - this.Cpt.dropdown._build(slcIndex[i], true); - } - - this.setFilterValue(slcIndex[i], slcSelectedValue); - } - } // for i - } - } - }, - _resetGrid: { - writable: true, - value: function () { - if (this.isFirstLoad) { - return; - } - - // grid was removed, grid row element is stored in fltGridEl property - if (!this.gridLayout) { - this.tbl.rows[this.filtersRowIndex].parentNode.insertBefore(this.fltGridEl, this.tbl.rows[this.filtersRowIndex]); - } - - // filters are appended in external placeholders elements - if (this.isExternalFlt) { - for (var ct = 0; ct < this.externalFltTgtIds.length; ct++) { - var extFlt = dom.id(this.externalFltTgtIds[ct]); - if (extFlt) { - extFlt.appendChild(this.externalFltEls[ct]); - var colFltType = this["col" + ct]; - //IE special treatment for gridLayout, appended filters are - //empty - if (this.gridLayout && this.externalFltEls[ct].innerHTML === "" && colFltType !== this.fltTypeInp) { - if (colFltType === this.fltTypeSlc || colFltType === this.fltTypeMulti) { - this.Cpt.dropdown.build(ct); - } - if (colFltType === this.fltTypeCheckList) { - this.Cpt.checkList.build(ct); - } - } - } - } - } - - this.nbFilterableRows = this.getRowsNb(); - this.nbVisibleRows = this.nbFilterableRows; - this.nbRows = this.tbl.rows.length; - if (this.isSortEnabled) { - this.sort = true; - } - - if (this.tbl.rows[this.filtersRowIndex].innerHTML === "") { - refreshFilters(this); - } else { - if (this.popUpFilters) { - this.headersRow++; - this.Cpt.popupFilter.buildAll(); - } - } - - /*** ie bug work-around, filters need to be re-generated since row - is empty; insertBefore method doesn't seem to work properly - with previously generated DOM nodes modified by innerHTML ***/ - function refreshFilters(o) { - o.tbl.deleteRow(o.filtersRowIndex); - o.remove(); - o.fltIds = []; - o.isFirstLoad = true; - if (o.popUpFilters) { - // o.RemovePopupFilters(); - o.Cpt.popupFilter.destroy(); - } - o._AddGrid(); - } - - if (!this.gridLayout) { - dom.addClass(this.tbl, this.prfxTf); - } - this._hasGrid = true; - } - }, - _containsStr: { - writable: true, - value: function (arg, data, fltType, forceMatch) { - // Improved by Cedric Wartel (cwl) - // automatic exact match for selects and special characters are now - // filtered - var regexp, modifier = (this.matchCase) ? "g" : "gi", exactMatch = !forceMatch ? this.exactMatch : forceMatch; - if (exactMatch || (fltType !== this.fltTypeInp && fltType)) { - regexp = new RegExp("(^\\s*)" + str.rgxEsc(arg) + "(\\s*$)", modifier); - } else { - regexp = new RegExp(str.rgxEsc(arg), modifier); - } - return regexp.test(data); - } - }, - includeFile: { - writable: true, - value: function (fileId, filePath, callback, type) { - var ftype = !type ? "script" : type, imported = this.isImported(filePath, ftype); - if (imported) { - return; - } - var o = this, isLoaded = false, file, head = dom.tag(doc, "head")[0]; - - if (str.lower(ftype) === "link") { - file = dom.create("link", ["id", fileId], ["type", "text/css"], ["rel", "stylesheet"], ["href", filePath]); - } else { - file = dom.create("script", ["id", fileId], ["type", "text/javascript"], ["src", filePath]); - } - - //Browser <> IE onload event works only for scripts, not for stylesheets - file.onload = file.onreadystatechange = function () { - if (!isLoaded && (!this.readyState || this.readyState === "loaded" || this.readyState === "complete")) { - isLoaded = true; - if (typeof callback === "function") { - callback.call(null, o); - } - } - }; - file.onerror = function () { - throw new Error("TF script could not load:\n" + this.src); - }; - head.appendChild(file); - } - }, - hasGrid: { - writable: true, - value: function () { - return this._hasGrid; - } - }, - getFiltersId: { - writable: true, - value: function () { - if (!this._hasGrid) { - return; - } - return this.fltIds; - } - }, - getValidRowsIndex: { - writable: true, - value: function (reCalc) { - if (!this._hasGrid) { - return; - } - if (!reCalc) { - return this.validRowsIndex; - } - - this.validRowsIndex = []; - for (var k = this.refRow; k < this.getRowsNb(true); k++) { - var r = this.tbl.rows[k]; - if (!this.paging) { - if (this.getRowDisplay(r) !== "none") { - this.validRowsIndex.push(r.rowIndex); - } - } else { - if (r.getAttribute("validRow") === "true" || r.getAttribute("validRow") === null) { - this.validRowsIndex.push(r.rowIndex); - } - } - } - return this.validRowsIndex; - } - }, - getFiltersRowIndex: { - writable: true, - value: function () { - if (!this._hasGrid) { - return; - } - return this.filtersRowIndex; - } - }, - getHeadersRowIndex: { - writable: true, - value: function () { - if (!this._hasGrid) { - return; - } - return this.headersRow; - } - }, - getStartRowIndex: { - writable: true, - value: function () { - if (!this._hasGrid) { - return; - } - return this.refRow; - } - }, - getLastRowIndex: { - writable: true, - value: function () { - if (!this._hasGrid) { - return; - } - return (this.nbRows - 1); - } - }, - getHeaderElement: { - writable: true, - value: function (colIndex) { - var table = this.gridLayout ? this.headTbl : this.tbl; - var header, tHead = dom.tag(this.tbl, "thead"); - for (var i = 0; i < this.nbCells; i++) { - if (i !== colIndex) { - continue; - } - if (tHead.length === 0) { - header = table.rows[this.headersRow].cells[i]; - } - if (tHead.length === 1) { - header = tHead[0].rows[this.headersRow].cells[i]; - } - break; - } - return header; - } - }, - config: { - writable: true, - value: function () { - return this.cfg; - } - }, - getFilterableRowsNb: { - writable: true, - value: function () { - return this.getRowsNb(false); - } - }, - numSortAsc: { - writable: true, - value: function (a, b) { - return (a - b); - } - }, - numSortDesc: { - writable: true, - value: function (a, b) { - return (b - a); - } - }, - removeNbFormat: { - writable: true, - value: function (data, format) { - if (!data) { - return; - } - if (!format) { - format = "us"; - } - var n = data; - if (str.lower(format) === "us") { - n = +n.replace(/[^\d\.-]/g, ""); - } else { - n = +n.replace(/[^\d\,-]/g, "").replace(",", "."); - } - return n; - } - }, - isImported: { - writable: true, - value: function (filePath, type) { - var imported = false, importType = !type ? "script" : type, attr = importType == "script" ? "src" : "href", files = dom.tag(doc, importType); - for (var i = 0; i < files.length; i++) { - if (files[i][attr] === undefined) { - continue; - } - if (files[i][attr].match(filePath)) { - imported = true; - break; - } - } - return imported; - } - }, - setOuterHtml: { - writable: true, - value: function () { - if (doc.body.__defineGetter__) { - if (HTMLElement) { - var element = HTMLElement.prototype; - if (element.__defineGetter__) { - element.__defineGetter__("outerHTML", function () { - var parent = this.parentNode; - var el = dom.create(parent.tagName); - el.appendChild(this); - var shtml = el.innerHTML; - parent.appendChild(this); - return shtml; - }); - } - if (element.__defineSetter__) { - HTMLElement.prototype.__defineSetter__("outerHTML", function (sHTML) { - var r = this.ownerDocument.createRange(); - r.setStartBefore(this); - var df = r.createContextualFragment(sHTML); - this.parentNode.replaceChild(df, this); - return sHTML; - }); - } - } - } - } - - // return TableFilter; - - // }); - - } - }); - - return TableFilter; - })(); - - exports.TableFilter = TableFilter; -}); \ No newline at end of file +define(["exports", "module", "event", "dom", "string", "cookie", "types", "array", "helpers", "date", "sort", "modules/store", "modules/gridLayout", "modules/loader", "modules/highlightKeywords", "modules/popupFilter", "modules/dropdown", "modules/checkList", "modules/rowsCounter", "modules/statusBar", "modules/paging", "modules/clearButton", "modules/help", "modules/alternateRows", "modules/colOps"], function(exports, module, _event, _dom, _string, _cookie, _types, _array, _helpers, _date, _sort, _modulesStore, _modulesGridLayout, _modulesLoader, _modulesHighlightKeywords, _modulesPopupFilter, _modulesDropdown, _modulesCheckList, _modulesRowsCounter, _modulesStatusBar, _modulesPaging, _modulesClearButton, _modulesHelp, _modulesAlternateRows, _modulesColOps){"use strict";var _prototypeProperties=function(child, staticProps, instanceProps){if(staticProps)Object.defineProperties(child, staticProps);if(instanceProps)Object.defineProperties(child.prototype, instanceProps);};var _classCallCheck=function(instance, Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}};var evt=_event.Event;var dom=_dom.Dom;var str=_string.Str;var cookie=_cookie.Cookie;var types=_types.Types;var array=_array.Arr;var hlp=_helpers.Helpers;var dateHelper=_date.DateHelper;var Sort=_sort.Sort;var Store=_modulesStore.Store;var GridLayout=_modulesGridLayout.GridLayout;var Loader=_modulesLoader.Loader;var HighlightKeyword=_modulesHighlightKeywords.HighlightKeyword;var PopupFilter=_modulesPopupFilter.PopupFilter;var Dropdown=_modulesDropdown.Dropdown;var CheckList=_modulesCheckList.CheckList;var RowsCounter=_modulesRowsCounter.RowsCounter;var StatusBar=_modulesStatusBar.StatusBar;var Paging=_modulesPaging.Paging;var ClearButton=_modulesClearButton.ClearButton;var Help=_modulesHelp.Help;var AlternateRows=_modulesAlternateRows.AlternateRows;var ColOps=_modulesColOps.ColOps;var global=window, isValidDate=dateHelper.isValid, formatDate=dateHelper.format, doc=global.document;var TableFilter=(function(){function TableFilter(id){_classCallCheck(this, TableFilter);if(arguments.length === 0){return;}this.id = id;this.version = "3.0";this.year = new Date().getFullYear();this.tbl = dom.id(id);this.startRow = null;this.refRow = null;this.headersRow = null;this.cfg = {};this.nbFilterableRows = null;this.nbRows = null;this.nbCells = null;this._hasGrid = false;this.enableModules = false;if(!this.tbl || str.lower(this.tbl.nodeName) !== "table" || this.getRowsNb() === 0){throw new Error("Could not instantiate TF object: HTML table not found.");}if(arguments.length > 1){for(var i=0; i < arguments.length; i++) {var arg=arguments[i];var argtype=typeof arg;switch(str.lower(argtype)){case "number":this.startRow = arg;break;case "object":this.cfg = arg;break;}}}var f=this.cfg;this.refRow = this.startRow === null?2:this.startRow + 1;try{this.nbCells = this.getCellsNb(this.refRow);}catch(e) {this.nbCells = this.getCellsNb(0);}this.basePath = f.base_path !== undefined?f.base_path:"";this.fltTypeInp = "input";this.fltTypeSlc = "select";this.fltTypeMulti = "multiple";this.fltTypeCheckList = "checklist";this.fltTypeNone = "none";this.fltCol = [];for(var j=0; j < this.nbCells; j++) {var cfgCol=f["col_" + j];var col=!cfgCol?this.fltTypeInp:str.lower(cfgCol);this.fltCol.push(col);this["col" + j] = col;}this.publicMethods = f.public_methods !== undefined?f.public_methods:false;this.fltGrid = f.grid === false?false:true;this.gridLayout = f.grid_layout?true:false;this.sourceTblHtml = null;if(this.gridLayout){if(this.tbl.outerHTML === undefined){setOuterHtml();}this.sourceTblHtml = this.tbl.outerHTML;}this.filtersRowIndex = f.filters_row_index || 0;this.headersRow = f.headers_row_index || (this.filtersRowIndex === 0?1:0);if(this.gridLayout){if(this.headersRow > 1){this.filtersRowIndex = this.headersRow + 1;}else {this.filtersRowIndex = 1;this.headersRow = 0;}}this.fltCellTag = f.filters_cell_tag !== "th" || f.filters_cell_tag !== "td"?"td":f.filters_cell_tag;this.fltIds = [];this.fltElms = [];this.searchArgs = null;this.tblData = [];this.validRowsIndex = null;this.fltGridEl = null;this.isFirstLoad = true;this.infDiv = null;this.lDiv = null;this.rDiv = null;this.mDiv = null;this.contDiv = null;this.infDivCssClass = f.inf_div_css_class || "inf";this.lDivCssClass = f.left_div_css_class || "ldiv";this.rDivCssClass = f.right_div_css_class || "rdiv";this.mDivCssClass = f.middle_div_css_class || "mdiv";this.contDivCssClass = f.content_div_css_class || "cont";this.stylesheet = f.stylesheet || this.basePath + "filtergrid.css";this.stylesheetId = this.id + "_style";this.fltsRowCssClass = f.flts_row_css_class || "fltrow";this.enableIcons = f.enable_icons === false?false:true;this.alternateBgs = f.alternate_rows === true?true:false;this.hasColWidth = f.col_width === true?true:false;this.colWidth = this.hasColWidth?f.col_width:null;this.fixedHeaders = f.fixed_headers === true?true:false;this.tBodyH = !isNaN(f.tbody_height)?f.tbody_height:200;this.fltCssClass = f.flt_css_class || "flt";this.fltMultiCssClass = f.flt_multi_css_class || "flt_multi";this.fltSmallCssClass = f.flt_small_css_class || "flt_s";this.singleFltCssClass = f.single_flt_css_class || "single_flt";this.isStartBgAlternate = true;this.enterKey = f.enter_key === false?false:true;this.isModFilterFn = f.mod_filter_fn === true?true:false;this.modFilterFn = this.isModFilterFn?f.mod_filter_fn:null;this.onBeforeFilter = types.isFn(f.on_before_filter)?f.on_before_filter:null;this.onAfterFilter = types.isFn(f.on_after_filter)?f.on_after_filter:null;this.matchCase = f.match_case === true?true:false;this.exactMatch = f.exact_match === true?true:false;this.linkedFilters = f.linked_filters === true?true:false;this.disableExcludedOptions = f.disable_excluded_options === true?true:false;this.activeFlt = null;this.activeFilterId = null;this.hasColOperation = f.col_operation?true:false;this.colOperation = null;this.hasVisibleRows = f.rows_always_visible?true:false;this.visibleRows = this.hasVisibleRows?f.rows_always_visible:[];this.searchType = f.search_type || "include";this.isExternalFlt = f.external_flt_grid === true?true:false;this.externalFltTgtIds = f.external_flt_grid_ids || null;this.externalFltEls = [];this.execDelay = !isNaN(f.exec_delay)?parseInt(f.exec_delay, 10):100;this.onFiltersLoaded = types.isFn(f.on_filters_loaded)?f.on_filters_loaded:null;this.singleSearchFlt = f.single_search_filter === true?true:false;this.onRowValidated = types.isFn(f.on_row_validated)?f.on_row_validated:null;this.customCellDataCols = f.custom_cell_data_cols?f.custom_cell_data_cols:[];this.customCellData = types.isFn(f.custom_cell_data)?f.custom_cell_data:null;this.watermark = f.watermark || "";this.isWatermarkArray = types.isArray(this.watermark);this.toolBarTgtId = f.toolbar_target_id || null;this.helpInstructions = f.help_instructions || false;this.popUpFilters = f.popup_filters === true?true:false;this.markActiveColumns = f.mark_active_columns === true?true:false;this.activeColumnsCssClass = f.active_columns_css_class || "activeHeader";this.onBeforeActiveColumn = types.isFn(f.on_before_active_column)?f.on_before_active_column:null;this.onAfterActiveColumn = types.isFn(f.on_after_active_column)?f.on_after_active_column:null;this.displayAllText = f.display_all_text || "";this.enableEmptyOption = f.enable_empty_option === true?true:false;this.emptyText = f.empty_text || "(Empty)";this.enableNonEmptyOption = f.enable_non_empty_option === true?true:false;this.nonEmptyText = f.non_empty_text || "(Non empty)";this.onSlcChange = f.on_change === false?false:true;this.sortSlc = f.sort_select === false?false:true;this.isSortNumAsc = f.sort_num_asc === true?true:false;this.sortNumAsc = this.isSortNumAsc?f.sort_num_asc:null;this.isSortNumDesc = f.sort_num_desc === true?true:false;this.sortNumDesc = this.isSortNumDesc?f.sort_num_desc:null;this.fillSlcOnDemand = f.fill_slc_on_demand === true?true:false;this.hasCustomSlcOptions = types.isObj(f.custom_slc_options)?true:false;this.customSlcOptions = types.isArray(f.custom_slc_options)?f.custom_slc_options:null;this.rgxOperator = f.regexp_operator || "rgx:";this.emOperator = f.empty_operator || "[empty]";this.nmOperator = f.nonempty_operator || "[nonempty]";this.orOperator = f.or_operator || "||";this.anOperator = f.and_operator || "&&";this.grOperator = f.greater_operator || ">";this.lwOperator = f.lower_operator || "<";this.leOperator = f.lower_equal_operator || "<=";this.geOperator = f.greater_equal_operator || ">=";this.dfOperator = f.different_operator || "!";this.lkOperator = f.like_operator || "*";this.eqOperator = f.equal_operator || "=";this.stOperator = f.start_with_operator || "{";this.enOperator = f.end_with_operator || "}";this.curExp = f.cur_exp || "^[¥£€$]";this.separator = f.separator || ",";this.rowsCounter = f.rows_counter === true?true:false;this.statusBar = f.status_bar === true?true:false;this.loader = f.loader === true?true:false;this.displayBtn = f.btn === true?true:false;this.btnText = f.btn_text || (!this.enableIcons?"Go":"");this.btnCssClass = f.btn_css_class || (!this.enableIcons?"btnflt":"btnflt_icon");this.btnReset = f.btn_reset === true?true:false;this.btnResetCssClass = f.btn_reset_css_class || "reset";this.onBeforeReset = types.isFn(f.on_before_reset)?f.on_before_reset:null;this.onAfterReset = types.isFn(f.on_after_reset)?f.on_after_reset:null;this.paging = f.paging === true?true:false;this.nbVisibleRows = 0;this.nbHiddenRows = 0;this.sort = f.sort === true?true:false;this.isSortEnabled = false;this.sorted = false;this.sortConfig = f.sort_config || {};this.sortConfig.name = this.sortConfig.name !== undefined?f.sort_config.name:"sortabletable";this.sortConfig.src = this.sortConfig.src !== undefined?f.sort_config.src:this.basePath + "sortabletable.js";this.sortConfig.adapterSrc = this.sortConfig.adapter_src !== undefined?f.sort_config.adapter_src:this.basePath + "tfAdapter.sortabletable.js";this.sortConfig.initialize = this.sortConfig.initialize !== undefined?f.sort_config.initialize:function(o){if(o.SetSortTable){o.SetSortTable();}};this.sortConfig.sortTypes = types.isArray(this.sortConfig.sort_types)?f.sort_config.sort_types:[];this.sortConfig.sortCol = this.sortConfig.sort_col !== undefined?f.sort_config.sort_col:null;this.sortConfig.asyncSort = this.sortConfig.async_sort === true?true:false;this.sortConfig.triggerIds = types.isArray(this.sortConfig.sort_trigger_ids)?f.sort_config.sort_trigger_ids:[];this.selectable = f.selectable === true?true:false;this.editable = f.editable === true?true:false;this.ezEditTableConfig = f.ezEditTable_config || {};this.ezEditTableConfig.name = this.ezEditTableConfig.name !== undefined?f.ezEditTable_config.name:"ezedittable";this.ezEditTableConfig.src = this.ezEditTableConfig.src !== undefined?f.ezEditTable_config.src:this.basePath + "ezEditTable/ezEditTable.js";this.ezEditTableConfig.loadStylesheet = this.ezEditTableConfig.loadStylesheet === true?true:false;this.ezEditTableConfig.stylesheet = this.ezEditTableConfig.stylesheet || this.basePath + "ezEditTable/ezEditTable.css";this.ezEditTableConfig.stylesheetName = this.ezEditTableConfig.stylesheetName !== undefined?f.ezEditTable_config.stylesheetName:"ezEditTableCss";this.ezEditTableConfig.err = "Failed to instantiate EditTable " + "object.\n\"ezEditTable\" module may not be available.";this.onKeyUp = f.on_keyup === true?true:false;this.onKeyUpDelay = !isNaN(f.on_keyup_delay)?f.on_keyup_delay:900;this.isUserTyping = null;this.onKeyUpTimer = undefined;this.highlightKeywords = f.highlight_keywords === true?true:false;this.defaultDateType = f.default_date_type || "DMY";this.thousandsSeparator = f.thousands_separator || ",";this.decimalSeparator = f.decimal_separator || ".";this.hasColNbFormat = f.col_number_format === true?true:false;this.colNbFormat = types.isArray(this.hasColNbFormat)?f.col_number_format:null;this.hasColDateType = f.col_date_type === true?true:false;this.colDateType = types.isArray(this.hasColDateType)?f.col_date_type:null;this.msgFilter = f.msg_filter || "Filtering data...";this.msgPopulate = f.msg_populate || "Populating filter...";this.msgPopulateCheckList = f.msg_populate_checklist || "Populating list...";this.msgChangePage = f.msg_change_page || "Collecting paging data...";this.msgClear = f.msg_clear || "Clearing filters...";this.msgChangeResults = f.msg_change_results || "Changing results per page...";this.msgResetValues = f.msg_reset_grid_values || "Re-setting filters values...";this.msgResetPage = f.msg_reset_page || "Re-setting page...";this.msgResetPageLength = f.msg_reset_page_length || "Re-setting page length...";this.msgSort = f.msg_sort || "Sorting data...";this.msgLoadExtensions = f.msg_load_extensions || "Loading extensions...";this.msgLoadThemes = f.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.prfxContentDiv = "cont_";this.prfxCheckListDiv = "chkdiv_";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_";this.prfxCounter = "counter_";this.prfxTotRows = "totrows_span_";this.prfxTotRowsTxt = "totRowsTextSpan_";this.prfxResetSpan = "resetspan_";this.prfxLoader = "load_";this.prfxStatus = "status_";this.prfxStatusSpan = "statusSpan_";this.prfxStatusTxt = "statusText_";this.prfxCookieFltsValues = "tf_flts_";this.prfxCookiePageNb = "tf_pgnb_";this.prfxCookiePageLen = "tf_pglen_";this.prfxMainTblCont = "gridCont_";this.prfxTblCont = "tblCont_";this.prfxHeadTblCont = "tblHeadCont_";this.prfxHeadTbl = "tblHead_";this.prfxGridFltTd = "_td_";this.prfxGridTh = "tblHeadTh_";this.prfxHelpSpan = "helpSpan_";this.prfxHelpDiv = "helpDiv_";this.prfxPopUpSpan = "popUpSpan_";this.prfxPopUpDiv = "popUpDiv_";this.hasStoredValues = false;this.rememberGridValues = f.remember_grid_values === true?true:false;this.fltsValuesCookie = this.prfxCookieFltsValues + this.id;this.rememberPageNb = this.paging && f.remember_page_number?true:false;this.pgNbCookie = this.prfxCookiePageNb + this.id;this.rememberPageLen = this.paging && f.remember_page_length?true:false;this.pgLenCookie = this.prfxCookiePageLen + this.id;this.hasExtensions = f.extensions === true?true:false;this.extensions = this.hasExtensions?f.extensions:null;this.enableDefaultTheme = f.enable_default_theme === true?true:false;this.hasThemes = f.enable_default_theme || f.themes && types.isObj(f.themes)?true:false;this.themes = this.hasThemes?f.themes:null;this.themesPath = f.themes_path || this.basePath + "TF_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};var o=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"}, getKeyCode:function getKeyCode(evt){return evt.charCode?evt.charCode:evt.keyCode?evt.keyCode:evt.which?evt.which:0;}, _DetectKey:function _DetectKey(e){if(!o.enterKey){return;}var _evt=e || global.event;if(_evt){var key=o.Evt.getKeyCode(_evt);if(key === 13){o._filter();evt.cancel(_evt);evt.stop(_evt);}else {o.isUserTyping = true;global.clearInterval(o.onKeyUpTimer);o.onKeyUpTimer = undefined;}}}, _OnKeyUp:function _OnKeyUp(e){if(!o.onKeyUp){return;}var _evt=e || global.event;var key=o.Evt.getKeyCode(_evt);o.isUserTyping = false;function filter(){global.clearInterval(o.onKeyUpTimer);o.onKeyUpTimer = undefined;if(!o.isUserTyping){o.filter();o.isUserTyping = null;}}if(key !== 13 && key !== 9 && key !== 27 && key !== 38 && key !== 40){if(o.onKeyUpTimer === undefined){o.onKeyUpTimer = global.setInterval(filter, o.onKeyUpDelay);}}else {global.clearInterval(o.onKeyUpTimer);o.onKeyUpTimer = undefined;}}, _OnKeyDown:function _OnKeyDown(e){if(!o.onKeyUp){return;}o.isUserTyping = true;}, _OnInpBlur:function _OnInpBlur(e){if(o.onKeyUp){o.isUserTyping = false;global.clearInterval(o.onKeyUpTimer);}if(o.ezEditTable){if(o.editable){o.ezEditTable.Editable.Set();}if(o.selectable){o.ezEditTable.Selection.Set();}}}, _OnInpFocus:function _OnInpFocus(e){var _evt=e || global.event;o.activeFilterId = this.getAttribute("id");o.activeFlt = dom.id(o.activeFilterId);if(o.popUpFilters){evt.cancel(_evt);evt.stop(_evt);}if(o.ezEditTable){if(o.editable){o.ezEditTable.Editable.Remove();}if(o.selectable){o.ezEditTable.Selection.Remove();}}}, _OnSlcFocus:function _OnSlcFocus(e){var _evt=e || global.event;o.activeFilterId = this.getAttribute("id");o.activeFlt = dom.id(o.activeFilterId);if(o.fillSlcOnDemand && this.getAttribute("filled") === "0"){var ct=this.getAttribute("ct");o.Cpt.dropdown._build(ct);}if(o.popUpFilters){evt.cancel(_evt);evt.stop(_evt);}}, _OnSlcChange:function _OnSlcChange(e){if(!o.activeFlt){return;}var colIndex=o.activeFlt.getAttribute("colIndex");var _evt=e || global.event;if(o.popUpFilters){evt.stop(_evt);}if(o.onSlcChange){o.filter();}}, _OnSlcBlur:function _OnSlcBlur(e){}, _OnCheckListClick:function _OnCheckListClick(){if(o.fillSlcOnDemand && this.getAttribute("filled") === "0"){var ct=this.getAttribute("ct");o.Cpt.checkList._build(ct);o.Cpt.checkList.checkListDiv[ct].onclick = null;o.Cpt.checkList.checkListDiv[ct].title = "";}}, _OnCheckListFocus:function _OnCheckListFocus(e){o.activeFilterId = this.firstChild.getAttribute("id");o.activeFlt = dom.id(o.activeFilterId);}, _OnCheckListBlur:function _OnCheckListBlur(e){}, _OnBtnClick:function _OnBtnClick(){o.filter();}, _OnSlcPagesChangeEvt:null, _EnableSlc:function _EnableSlc(){this.firstChild.disabled = false;this.firstChild.focus();this.onclick = null;}, _Paging:{nextEvt:null, prevEvt:null, lastEvt:null, firstEvt:null}};}_prototypeProperties(TableFilter, null, {init:{value:function init(){if(this._hasGrid){return;}if(!this.tbl){this.tbl = dom.id(this.id);}if(this.gridLayout){this.refRow = this.startRow === null?0:this.startRow;}if(this.popUpFilters && (this.filtersRowIndex === 0 && this.headersRow === 1 || this.gridLayout)){this.headersRow = 0;}var f=this.cfg, n=this.singleSearchFlt?1:this.nbCells, inpclass;if(window["tf_" + this.id] === undefined){window["tf_" + this.id] = this;}this.includeFile(this.stylesheetId, this.stylesheet, null, "link");if(this.hasThemes){this._LoadThemes();}if(this.rememberGridValues || this.rememberPageNb || this.rememberPageLen){this.Cpt.store = new Store(this);}if(this.gridLayout){this.Cpt.gridLayout = new GridLayout(this);this.Cpt.gridLayout.init();}if(this.loader){if(!this.Cpt.loader){this.Cpt.loader = new Loader(this);}}if(this.highlightKeywords){this.Cpt.highlightKeyword = new HighlightKeyword(this);}if(this.popUpFilters){if(!this.Cpt.popupFilter){this.Cpt.popupFilter = new PopupFilter(this);}this.Cpt.popupFilter.init();}if(!this.fltGrid){this.refRow = this.refRow - 1;if(this.gridLayout){this.refRow = 0;}this.nbFilterableRows = this.getRowsNb();this.nbVisibleRows = this.nbFilterableRows;this.nbRows = this.nbFilterableRows + this.refRow;}else {if(this.isFirstLoad){var fltrow;if(!this.gridLayout){var thead=dom.tag(this.tbl, "thead");if(thead.length > 0){fltrow = thead[0].insertRow(this.filtersRowIndex);}else {fltrow = this.tbl.insertRow(this.filtersRowIndex);}if(this.headersRow > 1 && this.filtersRowIndex <= this.headersRow && !this.popUpFilters){this.headersRow++;}if(this.popUpFilters){this.headersRow++;}fltrow.className = this.fltsRowCssClass;if(this.isExternalFlt && (!this.gridLayout || this.popUpFilters)){fltrow.style.display = "none";}}this.nbFilterableRows = this.getRowsNb();this.nbVisibleRows = this.nbFilterableRows;this.nbRows = this.tbl.rows.length;for(var i=0; i < n; i++) {if(this.popUpFilters){this.Cpt.popupFilter.build(i);}var fltcell=dom.create(this.fltCellTag), col=this["col" + i], externalFltTgtId=this.isExternalFlt && this.externalFltTgtIds?this.externalFltTgtIds[i]:null;if(this.singleSearchFlt){fltcell.colSpan = this.nbCells;}if(!this.gridLayout){fltrow.appendChild(fltcell);}inpclass = i == n - 1 && this.displayBtn?this.fltSmallCssClass:this.fltCssClass;if(col === undefined){col = f["col_" + i] === undefined?this.fltTypeInp:str.lower(f["col_" + i]);}if(this.singleSearchFlt){col = this.fltTypeInp;inpclass = this.singleFltCssClass;}if(col === this.fltTypeSlc || col === this.fltTypeMulti){if(!this.Cpt.dropdown){this.Cpt.dropdown = new Dropdown(this);}var dropdown=this.Cpt.dropdown;var slc=dom.create(this.fltTypeSlc, ["id", this.prfxFlt + i + "_" + this.id], ["ct", i], ["filled", "0"]);if(col === this.fltTypeMulti){slc.multiple = this.fltTypeMulti;slc.title = dropdown.multipleSlcTooltip;}slc.className = str.lower(col) === this.fltTypeSlc?inpclass:this.fltMultiCssClass;if(externalFltTgtId){dom.id(externalFltTgtId).appendChild(slc);this.externalFltEls.push(slc);}else {fltcell.appendChild(slc);}this.fltIds.push(this.prfxFlt + i + "_" + this.id);if(!this.fillSlcOnDemand){dropdown._build(i);}evt.add(slc, "keypress", this.Evt._DetectKey);evt.add(slc, "change", this.Evt._OnSlcChange);evt.add(slc, "focus", this.Evt._OnSlcFocus);evt.add(slc, "blur", this.Evt._OnSlcBlur);if(this.fillSlcOnDemand){var opt0=dom.createOpt(this.displayAllText, "");slc.appendChild(opt0);}}else if(col === this.fltTypeCheckList){if(!this.Cpt.checkList){this.Cpt.checkList = new CheckList(this);}var divCont=dom.create("div", ["id", this.prfxCheckListDiv + i + "_" + this.id], ["ct", i], ["filled", "0"]);divCont.className = this.Cpt.checkList.checkListDivCssClass;if(externalFltTgtId){dom.id(externalFltTgtId).appendChild(divCont);this.externalFltEls.push(divCont);}else {fltcell.appendChild(divCont);}this.Cpt.checkList.checkListDiv[i] = divCont;this.fltIds.push(this.prfxFlt + i + "_" + this.id);if(!this.fillSlcOnDemand){this.Cpt.checkList._build(i);}if(this.fillSlcOnDemand){evt.add(divCont, "click", this.Evt._OnCheckListClick);divCont.appendChild(dom.text(this.Cpt.checkList.activateCheckListTxt));}evt.add(divCont, "click", this.Evt._OnCheckListFocus);}else {var inptype=col === this.fltTypeInp?"text":"hidden";var inp=dom.create(this.fltTypeInp, ["id", this.prfxFlt + i + "_" + this.id], ["type", inptype], ["ct", i]);if(inptype !== "hidden" && this.watermark){inp.setAttribute("placeholder", this.isWatermarkArray?this.watermark[i]:this.watermark);}inp.className = inpclass;inp.onfocus = this.Evt._OnInpFocus;if(externalFltTgtId){dom.id(externalFltTgtId).appendChild(inp);this.externalFltEls.push(inp);}else {fltcell.appendChild(inp);}this.fltIds.push(this.prfxFlt + i + "_" + this.id);inp.onkeypress = this.Evt._DetectKey;inp.onkeydown = this.Evt._OnKeyDown;inp.onkeyup = this.Evt._OnKeyUp;inp.onblur = this.Evt._OnInpBlur;if(this.rememberGridValues){var flts_values=this.Cpt.store.getFilterValues(this.fltsValuesCookie);if(flts_values[i] != " "){this.setFilterValue(i, flts_values[i], false);}}}if(i == n - 1 && this.displayBtn){var btn=dom.create(this.fltTypeInp, ["id", this.prfxValButton + i + "_" + this.id], ["type", "button"], ["value", this.btnText]);btn.className = this.btnCssClass;if(externalFltTgtId){dom.id(externalFltTgtId).appendChild(btn);}else {fltcell.appendChild(btn);}btn.onclick = this.Evt._OnBtnClick;}}}else {this._resetGrid();}}if(this.rowsCounter){this.Cpt.rowsCounter = new RowsCounter(this);this.Cpt.rowsCounter.init();}if(this.statusBar){this.Cpt.statusBar = new StatusBar(this);this.Cpt.statusBar.init();}if(this.paging){this.Cpt.paging = new Paging(this);this.Cpt.paging.init();}if(this.btnReset){this.Cpt.clearButton = new ClearButton(this);this.Cpt.clearButton.init();}if(this.helpInstructions){this.Cpt.help = new Help(this);this.Cpt.help.init();}if(this.hasColWidth && !this.gridLayout){this.setColWidths();}if(this.alternateBgs){this.Cpt.alternateRows = new AlternateRows(this);this.Cpt.alternateRows.init();}if(this.hasColOperation){this.Cpt.colOps = new ColOps(this);this.Cpt.colOps.calc();}if(this.sort){this.SetSort();}if(this.selectable || this.editable){this.SetEditable();}this.isFirstLoad = false;this._hasGrid = true;if(this.rememberGridValues || this.rememberPageLen || this.rememberPageNb){this.resetValues();}if(!this.gridLayout){dom.addClass(this.tbl, this.prfxTf);}if(this.loader){this.Cpt.loader.show("none");}if(this.hasExtensions){this.LoadExtensions();}if(this.onFiltersLoaded){this.onFiltersLoaded.call(null, this);}}, writable:true, configurable:true}, EvtManager:{value:function EvtManager(evt, s){var o=this;var slcIndex=s && s.slcIndex !== undefined?s.slcIndex:null;var slcExternal=s && s.slcExternal !== undefined?s.slcExternal:false;var slcId=s && s.slcId !== undefined?s.slcId:null;var pgIndex=s && s.pgIndex !== undefined?s.pgIndex:null;function efx(){if(!evt){return;}switch(evt){case o.Evt.name.filter:if(o.isModFilterFn){o.modFilterFn.call(null, o);}else {o._filter();}break;case o.Evt.name.dropdown:if(o.linkedFilters){o.Cpt.dropdown._build(slcIndex, true);}else {o.Cpt.dropdown._build(slcIndex, false, slcExternal, slcId);}break;case o.Evt.name.checklist:o.Cpt.checkList._build(slcIndex, slcExternal, slcId);break;case o.Evt.name.changepage:o.Cpt.paging._changePage(pgIndex);break;case o.Evt.name.clear:o._clearFilters();o._filter();break;case o.Evt.name.changeresultsperpage:o.Cpt.paging._changeResultsPerPage();break;case o.Evt.name.resetvalues:o._resetValues();o._filter();break;case o.Evt.name.resetpage:o.Cpt.paging._resetPage(o.pgNbCookie);break;case o.Evt.name.resetpagelength:o.Cpt.paging._resetPageLength(o.pgLenCookie);break;case o.Evt.name.sort:void 0;break;case o.Evt.name.loadextensions:o._LoadExtensions();break;case o.Evt.name.loadthemes:o._LoadThemes();break;default:o["_" + evt].call(null, o, s);break;}if(o.statusBar){o.Cpt.statusBar.message("");}if(o.loader){o.Cpt.loader.show("none");}}if(this.loader || this.statusBar){try{this.Cpt.loader.show("");this.Cpt.statusBar.message(this["msg" + evt]);}catch(e) {}global.setTimeout(efx, this.execDelay);}else {efx();}}, writable:true, configurable:true}, ImportModule:{value:function ImportModule(module){if(!module.path || !module.name){return;}this.includeFile(module.name, module.path, module.init);}, writable:true, configurable:true}, LoadExtensions:{value:function LoadExtensions(){if(!this.Ext){var o=this;this.Ext = {list:{}, add:function add(extName, extDesc, extPath, extCallBack){var file=extPath.split("/")[extPath.split("/").length - 1], re=new RegExp(file), path=extPath.replace(re, "");o.Ext.list[extName] = {name:extName, description:extDesc, file:file, path:path, callback:extCallBack};}};}this.EvtManager(this.Evt.name.loadextensions);}, writable:true, configurable:true}, _LoadExtensions:{value:function _LoadExtensions(){if(!this.hasExtensions || !types.isArray(this.extensions.name) || !types.isArray(this.extensions.src)){return;}var ext=this.extensions;for(var e=0; e < ext.name.length; e++) {var extPath=ext.src[e], extName=ext.name[e], extInit=ext.initialize && ext.initialize[e]?ext.initialize[e]:null, extDesc=ext.description && ext.description[e]?ext.description[e]:null;this.Ext.add(extName, extDesc, extPath, extInit);if(this.isImported(extPath)){extInit.call(null, this);}else {this.includeFile(extName, extPath, extInit);}}}, writable:true, configurable:true}, LoadThemes:{value:function LoadThemes(){this.EvtManager(this.Evt.name.loadthemes);}, writable:true, configurable:true}, _LoadThemes:{value:function _LoadThemes(){if(!this.hasThemes){return;}if(!this.Thm){var o=this;this.Thm = {list:{}, add:function add(thmName, thmDesc, thmPath, thmCallBack){var file=thmPath.split("/")[thmPath.split("/").length - 1], re=new RegExp(file), path=thmPath.replace(re, "");o.Thm.list[thmName] = {name:thmName, description:thmDesc, file:file, path:path, callback:thmCallBack};}};}if(this.enableDefaultTheme){this.themes = {name:["DefaultTheme"], src:[this.themesPath + "Default/TF_Default.css"], description:["Default Theme"]};this.Thm.add("DefaultTheme", this.themesPath + "Default/TF_Default.css", "Default Theme");}if(types.isArray(this.themes.name) && types.isArray(this.themes.src)){var thm=this.themes;for(var i=0; i < thm.name.length; i++) {var thmPath=thm.src[i], thmName=thm.name[i], thmInit=thm.initialize && thm.initialize[i]?thm.initialize[i]:null, thmDesc=thm.description && thm.description[i]?thm.description[i]:null;this.Thm.add(thmName, thmDesc, thmPath, thmInit);if(!this.isImported(thmPath, "link")){this.includeFile(thmName, thmPath, null, "link");}if(types.isFn(thmInit)){thmInit.call(null, this);}}}this.btnResetText = null;this.btnResetHtml = "";this.btnPrevPageHtml = "";this.btnNextPageHtml = "";this.btnFirstPageHtml = "";this.btnLastPageHtml = "";this.loader = true;this.loaderHtml = "
";this.loaderText = null;}, writable:true, configurable:true}, remove:{value:function remove(){if(this.fltGrid && this._hasGrid){var rows=this.tbl.rows;if(this.paging){this.Cpt.paging.destroy();}if(this.statusBar){this.Cpt.statusBar.destroy();}if(this.rowsCounter){this.Cpt.rowsCounter.destroy();}if(this.btnReset){this.Cpt.clearButton.destroy();}if(this.helpInstructions){this.Cpt.help.destroy();}if(this.isExternalFlt && !this.popUpFilters){this.RemoveExternalFlts();}if(this.infDiv){this.removeToolbar();}if(this.highlightKeywords){this.Cpt.highlightKeyword.unhighlightAll();}if(this.sort){this.RemoveSort();}if(this.loader){this.Cpt.loader.remove();}if(this.popUpFilters){this.Cpt.popupFilter.destroy();}if(this.markActiveColumns){this.clearActiveColumns();}if(this.editable || this.selectable){this.RemoveEditable();}for(var j=this.refRow; j < this.nbRows; j++) {rows[j].style.display = "";try{if(rows[j].hasAttribute("validRow")){rows[j].removeAttribute("validRow");}}catch(e) {var row=rows[j];var attribs=row.attributes;for(var x=0; x < attribs.length; x++) {if(str.lower(attribs.nodeName) === "validrow"){row.removeAttribute("validRow");}}}if(this.alternateBgs){this.Cpt.alternateRows.removeRowBg(j);}}if(this.fltGrid && !this.gridLayout){this.fltGridEl = rows[this.filtersRowIndex];this.tbl.deleteRow(this.filtersRowIndex);}if(this.gridLayout){this.Cpt.gridLayout.destroy();}dom.removeClass(this.tbl, this.prfxTf);this.activeFlt = null;this.isStartBgAlternate = true;this._hasGrid = false;this.tbl = null;}}, writable:true, configurable:true}, setToolbar:{value:function setToolbar(){if(this.infDiv !== null){return;}var infdiv=dom.create("div", ["id", this.prfxInfDiv + this.id]);infdiv.className = this.infDivCssClass;if(this.toolBarTgtId){dom.id(this.toolBarTgtId).appendChild(infdiv);}else if(this.gridLayout){this.Cpt.gridLayout.tblMainCont.appendChild(infdiv);infdiv.className = this.gridInfDivCssClass;}else {this.tbl.parentNode.insertBefore(infdiv, this.tbl);}this.infDiv = dom.id(this.prfxInfDiv + this.id);var ldiv=dom.create("div", ["id", this.prfxLDiv + this.id]);ldiv.className = this.lDivCssClass;infdiv.appendChild(ldiv);this.lDiv = dom.id(this.prfxLDiv + this.id);var rdiv=dom.create("div", ["id", this.prfxRDiv + this.id]);rdiv.className = this.rDivCssClass;infdiv.appendChild(rdiv);this.rDiv = dom.id(this.prfxRDiv + this.id);var mdiv=dom.create("div", ["id", this.prfxMDiv + this.id]);mdiv.className = this.mDivCssClass;infdiv.appendChild(mdiv);this.mDiv = dom.id(this.prfxMDiv + this.id);if(!this.helpInstructions){if(!this.Cpt.help){this.Cpt.help = new Help(this);}this.Cpt.help.init();}}, writable:true, configurable:true}, removeToolbar:{value:function removeToolbar(){if(!this.infDiv){return;}this.infDiv.parentNode.removeChild(this.infDiv);this.infDiv = null;}, writable:true, configurable:true}, RemoveExternalFlts:{value:function RemoveExternalFlts(){if(!this.isExternalFlt && !this.externalFltTgtIds){return;}for(var ct=0; ct < this.externalFltTgtIds.length; ct++) {var externalFltTgtId=this.externalFltTgtIds[ct], externalFlt=dom.id(externalFltTgtId);if(externalFlt){externalFlt.innerHTML = "";}}}, writable:true, configurable:true}, SetSort:{value:function SetSort(){var fn=this.Evt._EnableSort, sortConfig=this.sortConfig;if(!types.isFn(fn)){var o=this;this.Evt._EnableSort = function(){if(o.isSortEnabled && !o.gridLayout){return;}if(this.isImported(sortConfig.adapterSrc)){sortConfig.initialize.call(null, o);}else {o.includeFile(sortConfig.name + "_adapter", sortConfig.adapterSrc, function(){sortConfig.initialize.call(null, o);});}};}if(this.isImported(this.sortConfig.src)){this.Evt._EnableSort();}else {this.includeFile(sortConfig.name, sortConfig.src, this.Evt._EnableSort);}}, writable:true, configurable:true}, RemoveSort:{value:function RemoveSort(){this.sort = false;}, writable:true, configurable:true}, Sort:{value:function Sort(){this.EvtManager(this.Evt.name.sort);}, writable:true, configurable:true}, SetEditable:{value:function SetEditable(){var ezEditConfig=this.ezEditTableConfig;if(this.isImported(ezEditConfig.src)){this._EnableEditable();}else {this.includeFile(ezEditConfig.name, ezEditConfig.src, this._EnableEditable);}if(ezEditConfig.loadStylesheet && !this.isImported(ezEditConfig.stylesheet, "link")){this.includeFile(ezEditConfig.stylesheetName, ezEditConfig.stylesheet, null, "link");}}, writable:true, configurable:true}, RemoveEditable:{value:function RemoveEditable(){var ezEditTable=this.ezEditTable;if(ezEditTable){if(this.selectable){ezEditTable.Selection.ClearSelections();ezEditTable.Selection.Remove();}if(this.editable){ezEditTable.Editable.Remove();}}}, writable:true, configurable:true}, ResetEditable:{value:function ResetEditable(){var ezEditTable=this.ezEditTable;if(ezEditTable){if(this.selectable){ezEditTable.Selection.Set();}if(this.editable){ezEditTable.Editable.Set();}}}, writable:true, configurable:true}, _EnableEditable:{value:function _EnableEditable(o){if(!o){o = this;}var startRow, ezEditConfig=o.ezEditTableConfig, thead=dom.tag(o.tbl, "thead");if(thead.length > 0 && !ezEditConfig.startRow){startRow = undefined;}else {startRow = ezEditConfig.startRow || o.refRow;}ezEditConfig.scroll_into_view = ezEditConfig.scroll_into_view === false?false:true;ezEditConfig.base_path = ezEditConfig.base_path || o.basePath + "ezEditTable/";ezEditConfig.editable = o.editable = o.cfg.editable;ezEditConfig.selection = o.selectable = o.cfg.selectable;if(o.selectable){ezEditConfig.default_selection = ezEditConfig.default_selection || "row";}ezEditConfig.active_cell_css = ezEditConfig.active_cell_css || "ezETSelectedCell";o._lastValidRowIndex = 0;o._lastRowIndex = 0;if(o.selectable){var onAfterSelection=function onAfterSelection(et, selectedElm, e){if(!o.validRowsIndex){return;}var validIndexes=o.validRowsIndex, validIdxLen=validIndexes.length, row=et.defaultSelection !== "row"?selectedElm.parentNode:selectedElm, cell=selectedElm.nodeName === "TD"?selectedElm:null, keyCode=e !== undefined?et.Event.GetKey(e):0, isRowValid=array.has(validIndexes, row.rowIndex), nextRowIndex, d=keyCode === 34 || keyCode === 33?o.pagingLength || et.nbRowsPerPage:1;if(!isRowValid){if(row.rowIndex > o._lastRowIndex){if(row.rowIndex >= validIndexes[validIdxLen - 1]){nextRowIndex = validIndexes[validIdxLen - 1];}else {var calcRowIndex=o._lastValidRowIndex + d;if(calcRowIndex > validIdxLen - 1){nextRowIndex = validIndexes[validIdxLen - 1];}else {nextRowIndex = validIndexes[calcRowIndex];}}}else {if(row.rowIndex <= validIndexes[0]){nextRowIndex = validIndexes[0];}else {var v=validIndexes[o._lastValidRowIndex - d];nextRowIndex = v?v:validIndexes[0];}}o._lastRowIndex = row.rowIndex;DoSelection(nextRowIndex);}else {if(keyCode !== 34 && keyCode !== 33){o._lastValidRowIndex = array.indexByValue(validIndexes, row.rowIndex);o._lastRowIndex = row.rowIndex;}else {if(keyCode === 34){if(o._lastValidRowIndex + d <= validIdxLen - 1){nextRowIndex = validIndexes[o._lastValidRowIndex + d];}else {nextRowIndex = [validIdxLen - 1];}}else {if(o._lastValidRowIndex - d <= validIndexes[0]){nextRowIndex = validIndexes[0];}else {nextRowIndex = validIndexes[o._lastValidRowIndex - d];}}o._lastRowIndex = nextRowIndex;o._lastValidRowIndex = array.indexByValue(validIndexes, nextRowIndex);DoSelection(nextRowIndex);}}var DoSelection=function DoSelection(nextRowIndex){if(et.defaultSelection === "row"){et.Selection.SelectRowByIndex(nextRowIndex);}else {et.ClearSelections();var cellIndex=selectedElm.cellIndex, row=o.tbl.rows[nextRowIndex];if(et.defaultSelection === "both"){et.Selection.SelectRowByIndex(nextRowIndex);}if(row){et.Selection.SelectCell(row.cells[cellIndex]);}}if(o.validRowsIndex.length !== o.getRowsNb()){var r=o.tbl.rows[nextRowIndex];if(r){r.scrollIntoView(false);}if(cell){if(cell.cellIndex === o.getCellsNb() - 1 && o.gridLayout){o.tblCont.scrollLeft = 100000000;}else if(cell.cellIndex === 0 && o.gridLayout){o.tblCont.scrollLeft = 0;}else {cell.scrollIntoView(false);}}}};};var onBeforeSelection=function onBeforeSelection(et, selectedElm, e){var row=et.defaultSelection !== "row"?selectedElm.parentNode:selectedElm;if(o.paging){if(o.nbPages > 1){et.nbRowsPerPage = o.pagingLength;var validIndexes=o.validRowsIndex, validIdxLen=validIndexes.length, pagingEndRow=parseInt(o.startPagingRow, 10) + parseInt(o.pagingLength, 10);var rowIndex=row.rowIndex;if(rowIndex === validIndexes[validIdxLen - 1] && o.currentPageNb != o.nbPages){o.Cpt.paging.setPage("last");}else if(rowIndex == validIndexes[0] && o.currentPageNb !== 1){o.Cpt.paging.setPage("first");}else if(rowIndex > validIndexes[pagingEndRow - 1] && rowIndex < validIndexes[validIdxLen - 1]){o.Cpt.paging.setPage("next");}else if(rowIndex < validIndexes[o.startPagingRow] && rowIndex > validIndexes[0]){o.Cpt.paging.setPage("previous");}}}};if(o.paging){o.onAfterChangePage = function(tf, i){var et=tf.ezEditTable;var row=et.Selection.GetActiveRow();if(row){row.scrollIntoView(false);}var cell=et.Selection.GetActiveCell();if(cell){cell.scrollIntoView(false);}};}if(ezEditConfig.default_selection === "row"){var fnB=ezEditConfig.on_before_selected_row;ezEditConfig.on_before_selected_row = function(){onBeforeSelection(arguments[0], arguments[1], arguments[2]);if(fnB){fnB.call(null, arguments[0], arguments[1], arguments[2]);}};var fnA=ezEditConfig.on_after_selected_row;ezEditConfig.on_after_selected_row = function(){onAfterSelection(arguments[0], arguments[1], arguments[2]);if(fnA){fnA.call(null, arguments[0], arguments[1], arguments[2]);}};}else {var fnD=ezEditConfig.on_before_selected_cell;ezEditConfig.on_before_selected_cell = function(){onBeforeSelection(arguments[0], arguments[1], arguments[2]);if(fnD){fnD.call(null, arguments[0], arguments[1], arguments[2]);}};var fnC=ezEditConfig.on_after_selected_cell;ezEditConfig.on_after_selected_cell = function(){onAfterSelection(arguments[0], arguments[1], arguments[2]);if(fnC){fnC.call(null, arguments[0], arguments[1], arguments[2]);}};}}if(o.editable){var fnE=ezEditConfig.on_added_dom_row;ezEditConfig.on_added_dom_row = function(){o.nbFilterableRows++;if(!o.paging){o.Cpt.rowsCounter.refresh();}else {o.nbRows++;o.nbVisibleRows++;o.nbFilterableRows++;o.paging = false;o.Cpt.paging.destroy();o.Cpt.paging.addPaging();}if(o.alternateBgs){o.Cpt.alternateRows.init();}if(fnE){fnE.call(null, arguments[0], arguments[1], arguments[2]);}};if(ezEditConfig.actions && ezEditConfig.actions["delete"]){var fnF=ezEditConfig.actions["delete"].on_after_submit;ezEditConfig.actions["delete"].on_after_submit = function(){o.nbFilterableRows--;if(!o.paging){o.Cpt.rowsCounter.refresh();}else {o.nbRows--;o.nbVisibleRows--;o.nbFilterableRows--;o.paging = false;o.Cpt.paging.destroy();o.Cpt.paging.addPaging(false);}if(o.alternateBgs){o.Cpt.alternateRows.init();}if(fnF){fnF.call(null, arguments[0], arguments[1]);}};}}try{o.ezEditTable = new EditTable(o.id, ezEditConfig, startRow);o.ezEditTable.Init();}catch(e) {console.log(ezEditConfig.err);}}, writable:true, configurable:true}, resetValues:{value:function resetValues(){this.EvtManager(this.Evt.name.resetvalues);}, writable:true, configurable:true}, _resetValues:{value:function _resetValues(){if(this.rememberGridValues && this.fillSlcOnDemand){this.resetGridValues(this.fltsValuesCookie);}if(this.rememberPageLen){this.Cpt.paging.resetPageLength(this.pgLenCookie);}if(this.rememberPageNb){this.Cpt.paging.resetPage(this.pgNbCookie);}}, writable:true, configurable:true}, resetGridValues:{value:function resetGridValues(name){if(!this.fillSlcOnDemand){return;}var fltsValues=this.Cpt.store.getFilterValues(name), slcFltsIndex=this.getFiltersByType(this.fltTypeSlc, true), multiFltsIndex=this.getFiltersByType(this.fltTypeMulti, true);if(Number(fltsValues[fltsValues.length - 1]) === this.fltIds.length){for(var i=0; i < fltsValues.length - 1; i++) {if(fltsValues[i] === " "){continue;}var s, opt;if(this["col" + i] === this.fltTypeSlc || this["col" + i] === this.fltTypeMulti){var slc=dom.id(this.fltIds[i]);slc.options[0].selected = false;if(array.has(slcFltsIndex, i)){opt = dom.createOpt(fltsValues[i], fltsValues[i], true);slc.appendChild(opt);this.hasStoredValues = true;}if(array.has(multiFltsIndex, i)){s = fltsValues[i].split(" " + this.orOperator + " ");for(j = 0; j < s.length; j++) {if(s[j] === ""){continue;}opt = dom.createOpt(s[j], s[j], true);slc.appendChild(opt);this.hasStoredValues = true;}}}else if(this["col" + i] == this.fltTypeCheckList){var checkList=this.Cpt.checkList;var divChk=checkList.checkListDiv[i];divChk.title = divChk.innerHTML;divChk.innerHTML = "";var ul=dom.create("ul", ["id", this.fltIds[i]], ["colIndex", i]);ul.className = checkList.checkListCssClass;var li0=dom.createCheckItem(this.fltIds[i] + "_0", "", this.displayAllText);li0.className = checkList.checkListItemCssClass;ul.appendChild(li0);divChk.appendChild(ul);s = fltsValues[i].split(" " + this.orOperator + " ");for(j = 0; j < s.length; j++) {if(s[j] === ""){continue;}var li=dom.createCheckItem(this.fltIds[i] + "_" + (j + 1), s[j], s[j]);li.className = checkList.checkListItemCssClass;ul.appendChild(li);li.check.checked = true;checkList.setCheckListValues(li.check);this.hasStoredValues = true;}}}if(!this.hasStoredValues && this.paging){this.Cpt.paging.setPagingInfo();}}}, writable:true, configurable:true}, filter:{value:function filter(){this.EvtManager(this.Evt.name.filter);}, writable:true, configurable:true}, _filter:{value:function _filter(){if(!this.fltGrid || !this._hasGrid && !this.isFirstLoad){return;}if(this.onBeforeFilter){this.onBeforeFilter.call(null, this);}var row=this.tbl.rows, f=this.cfg, hiddenrows=0;this.validRowsIndex = [];var o=this;if(this.highlightKeywords){this.Cpt.highlightKeyword.unhighlightAll();}if(this.popUpFilters){this.Cpt.popupFilter.buildIcons();}if(this.markActiveColumns){this.clearActiveColumns();}this.searchArgs = this.getFiltersValue();var num_cell_data, nbFormat;var re_le=new RegExp(this.leOperator), re_ge=new RegExp(this.geOperator), re_l=new RegExp(this.lwOperator), re_g=new RegExp(this.grOperator), re_d=new RegExp(this.dfOperator), re_lk=new RegExp(str.rgxEsc(this.lkOperator)), re_eq=new RegExp(this.eqOperator), re_st=new RegExp(this.stOperator), re_en=new RegExp(this.enOperator), re_an=new RegExp(this.anOperator), re_cr=new RegExp(this.curExp), re_em=this.emOperator, re_nm=this.nmOperator, re_re=new RegExp(str.rgxEsc(this.rgxOperator));function highlight(str, ok, cell){if(o.highlightKeywords && ok){str = str.replace(re_lk, "");str = str.replace(re_eq, "");str = str.replace(re_st, "");str = str.replace(re_en, "");var w=str;if(re_le.test(str) || re_ge.test(str) || re_l.test(str) || re_g.test(str) || re_d.test(str)){w = dom.getText(cell);}if(w !== ""){o.Cpt.highlightKeyword.highlight(cell, w, o.Cpt.highlightKeyword.highlightCssClass);}}}function hasArg(sA, cell_data, j){var occurence;var hasLO=re_l.test(sA), hasLE=re_le.test(sA), hasGR=re_g.test(sA), hasGE=re_ge.test(sA), hasDF=re_d.test(sA), hasEQ=re_eq.test(sA), hasLK=re_lk.test(sA), hasAN=re_an.test(sA), hasST=re_st.test(sA), hasEN=re_en.test(sA), hasEM=re_em === sA, hasNM=re_nm === sA, hasRE=re_re.test(sA);var isLDate=hasLO && isValidDate(sA.replace(re_l, ""), dtType);var isLEDate=hasLE && isValidDate(sA.replace(re_le, ""), dtType);var isGDate=hasGR && isValidDate(sA.replace(re_g, ""), dtType);var isGEDate=hasGE && isValidDate(sA.replace(re_ge, ""), dtType);var isDFDate=hasDF && isValidDate(sA.replace(re_d, ""), dtType);var isEQDate=hasEQ && isValidDate(sA.replace(re_eq, ""), dtType);var dte1, dte2;if(isValidDate(cell_data, dtType)){dte1 = formatDate(cell_data, dtType);if(isLDate){dte2 = formatDate(sA.replace(re_l, ""), dtType);occurence = dte1 < dte2;}else if(isLEDate){dte2 = formatDate(sA.replace(re_le, ""), dtType);occurence = dte1 <= dte2;}else if(isGEDate){dte2 = formatDate(sA.replace(re_ge, ""), dtType);occurence = dte1 >= dte2;}else if(isGDate){dte2 = formatDate(sA.replace(re_g, ""), dtType);occurence = dte1 > dte2;}else if(isDFDate){dte2 = formatDate(sA.replace(re_d, ""), dtType);occurence = dte1.toString() != dte2.toString();}else if(isEQDate){dte2 = formatDate(sA.replace(re_eq, ""), dtType);occurence = dte1.toString() == dte2.toString();}else if(re_lk.test(sA)){occurence = o._containsStr(sA.replace(re_lk, ""), cell_data, null, false);}else if(isValidDate(sA, dtType)){dte2 = formatDate(sA, dtType);occurence = dte1.toString() == dte2.toString();}else if(hasEM){occurence = str.isEmpty(cell_data);}else if(hasNM){occurence = !str.isEmpty(cell_data);}}else {if(o.hasColNbFormat && o.colNbFormat[j]){num_cell_data = removeNbFormat(cell_data, o.colNbFormat[j]);nbFormat = o.colNbFormat[j];}else {if(o.thousandsSeparator === "," && o.decimalSeparator === "."){num_cell_data = removeNbFormat(cell_data, "us");nbFormat = "us";}else {num_cell_data = removeNbFormat(cell_data, "eu");nbFormat = "eu";}}if(hasLE){occurence = num_cell_data <= removeNbFormat(sA.replace(re_le, ""), nbFormat);}else if(hasGE){occurence = num_cell_data >= removeNbFormat(sA.replace(re_ge, ""), nbFormat);}else if(hasLO){occurence = num_cell_data < removeNbFormat(sA.replace(re_l, ""), nbFormat);}else if(hasGR){occurence = num_cell_data > removeNbFormat(sA.replace(re_g, ""), nbFormat);}else if(hasDF){occurence = o._containsStr(sA.replace(re_d, ""), cell_data)?false:true;}else if(hasLK){occurence = o._containsStr(sA.replace(re_lk, ""), cell_data, null, false);}else if(hasEQ){occurence = o._containsStr(sA.replace(re_eq, ""), cell_data, null, true);}else if(hasST){occurence = cell_data.indexOf(sA.replace(re_st, "")) === 0?true:false;}else if(hasEN){var searchArg=sA.replace(re_en, "");occurence = cell_data.lastIndexOf(searchArg, cell_data.length - 1) === cell_data.length - 1 - (searchArg.length - 1) && cell_data.lastIndexOf(searchArg, cell_data.length - 1) > -1?true:false;}else if(hasEM){occurence = str.isEmpty(cell_data);}else if(hasNM){occurence = !str.isEmpty(cell_data);}else if(hasRE){try{var srchArg=sA.replace(re_re, "");var rgx=new RegExp(srchArg);occurence = rgx.test(cell_data);}catch(e) {occurence = false;}}else {var fCol=f["col_" + j];occurence = o._containsStr(sA, cell_data, !fCol?o.fltTypeInp:fCol);}}return occurence;}for(var k=this.refRow; k < this.nbRows; k++) {if(row[k].style.display === "none"){row[k].style.display = "";}var cell=row[k].cells, nchilds=cell.length;if(nchilds !== this.nbCells){continue;}var occurence=[], isRowValid=this.searchType === "include"?true:false, singleFltRowValid=false;for(var j=0; j < nchilds; j++) {var sA=this.searchArgs[this.singleSearchFlt?0:j], dtType=this.hasColDateType?this.colDateType[j]:this.defaultDateType;if(sA === ""){continue;}var cell_data=str.matchCase(this.getCellData(j, cell[j]), this.matchCase);var sAOrSplit=sA.split(this.orOperator), hasMultiOrSA=sAOrSplit.length > 1?true:false, sAAndSplit=sA.split(this.anOperator), hasMultiAndSA=sAAndSplit.length > 1?true:false;if(hasMultiOrSA || hasMultiAndSA){var cS, occur=false, s=hasMultiOrSA?sAOrSplit:sAAndSplit;for(var w=0; w < s.length; w++) {cS = str.trim(s[w]);occur = hasArg(cS, cell_data, j);highlight(cS, occur, cell[j]);if(hasMultiOrSA && occur){break;}if(hasMultiAndSA && !occur){break;}}occurence[j] = occur;}else {occurence[j] = hasArg(str.trim(sA), cell_data, j);highlight(sA, occurence[j], cell[j]);}if(!occurence[j]){isRowValid = this.searchType === "include"?false:true;}if(this.singleSearchFlt && occurence[j]){singleFltRowValid = true;}if(this.popUpFilters){this.Cpt.popupFilter.buildIcon(j, true);}if(this.markActiveColumns){if(k === this.refRow){if(this.onBeforeActiveColumn){this.onBeforeActiveColumn.call(null, this, j);}dom.addClass(this.getHeaderElement(j), this.activeColumnsCssClass);if(this.onAfterActiveColumn){this.onAfterActiveColumn.call(null, this, j);}}}}if(this.singleSearchFlt && singleFltRowValid){isRowValid = true;}if(!isRowValid){this.validateRow(k, false);if(this.hasVisibleRows && array.has(this.visibleRows, k) && !this.paging){this.validRowsIndex.push(k);}else {hiddenrows++;}}else {this.validateRow(k, true);this.validRowsIndex.push(k);if(this.alternateBgs){this.Cpt.alternateRows.setRowBg(k, this.validRowsIndex.length);}if(this.onRowValidated){this.onRowValidated.call(null, this, k);}}}this.nbVisibleRows = this.validRowsIndex.length;this.nbHiddenRows = hiddenrows;this.isStartBgAlternate = false;if(this.rememberGridValues){this.Cpt.store.saveFilterValues(this.fltsValuesCookie);}if(!this.paging){this.applyGridProps();}else {this.startPagingRow = 0;this.currentPageNb = 1;this.Cpt.paging.setPagingInfo(this.validRowsIndex);}if(this.onAfterFilter){this.onAfterFilter.call(null, this);}}, writable:true, configurable:true}, applyGridProps:{value:function applyGridProps(){if(this.activeFlt && str.lower(this.activeFlt.nodeName) === this.fltTypeSlc && !this.popUpFilters){this.activeFlt.blur();if(this.activeFlt.parentNode){this.activeFlt.parentNode.focus();}}if(this.visibleRows){this.enforceVisibility();}if(this.hasColOperation){this.Cpt.colOps.calc();}if(this.linkedFilters){this.linkFilters();}var nr=!this.paging && this.hasVisibleRows?this.nbVisibleRows - this.visibleRows.length:this.nbVisibleRows;if(this.rowsCounter){this.Cpt.rowsCounter.refresh(nr);}if(this.popUpFilters){this.Cpt.popupFilter.closeAll();}}, writable:true, configurable:true}, getColValues:{value:function getColValues(colindex, num, exclude){if(!this.fltGrid){return;}var row=this.tbl.rows, colValues=[];for(var i=this.refRow; i < this.nbRows; i++) {var isExludedRow=false;if(exclude && types.isArray(exclude)){isExludedRow = array.has(exclude, i);}var cell=row[i].cells, nchilds=cell.length;if(nchilds == this.nbCells && !isExludedRow){for(var j=0; j < nchilds; j++) {if(j === colindex && row[i].style.display === ""){var cell_data=str.lower(this.getCellData(j, cell[j])), nbFormat=this.colNbFormat?this.colNbFormat[colindex]:null, data=num?removeNbFormat(cell_data, nbFormat):cell_data;colValues.push(data);}}}}return colValues;}, writable:true, configurable:true}, getFilterValue:{value:function getFilterValue(index){if(!this.fltGrid){return;}var fltValue, flt=this.getFilterElement(index);if(!flt){return "";}var fltColType=this.fltCol[index];if(fltColType !== this.fltTypeMulti && fltColType !== this.fltTypeCheckList){fltValue = flt.value;}else if(fltColType === this.fltTypeMulti){fltValue = "";for(var j=0; j < flt.options.length; j++) {if(flt.options[j].selected){fltValue = fltValue.concat(flt.options[j].value + " " + this.orOperator + " ");}}fltValue = fltValue.substr(0, fltValue.length - 4);}else if(fltColType === this.fltTypeCheckList){if(flt.getAttribute("value") !== null){fltValue = flt.getAttribute("value");fltValue = fltValue.substr(0, fltValue.length - 3);}else {fltValue = "";}}return fltValue;}, writable:true, configurable:true}, getFiltersValue:{value:function getFiltersValue(){if(!this.fltGrid){return;}var searchArgs=[];for(var i=0; i < this.fltIds.length; i++) {searchArgs.push(str.trim(str.matchCase(this.getFilterValue(i), this.matchCase)));}return searchArgs;}, writable:true, configurable:true}, getFilterId:{value:function getFilterId(index){if(!this.fltGrid){return;}return this.fltIds[i];}, writable:true, configurable:true}, getFiltersByType:{value:function getFiltersByType(type, bool){if(!this.fltGrid){return;}var arr=[];for(var i=0; i < this.fltIds.length; i++) {var fltType=this["col" + i];if(fltType === str.lower(type)){var a=bool?i:this.fltIds[i];arr.push(a);}}return arr;}, writable:true, configurable:true}, getFilterElement:{value:function getFilterElement(index){if(!this.fltGrid){return null;}return dom.id(this.fltIds[index]);}, writable:true, configurable:true}, getCellsNb:{value:function getCellsNb(rowIndex){var tr=!rowIndex?this.tbl.rows[0]:this.tbl.rows[rowIndex];return tr.cells.length;}, writable:true, configurable:true}, getRowsNb:{value:function getRowsNb(includeHeaders){var s=!this.refRow?0:this.refRow, ntrs=this.tbl.rows.length;if(includeHeaders){s = 0;}return parseInt(ntrs - s, 10);}, writable:true, configurable:true}, getCellData:{value:function getCellData(i, cell){if(i === undefined || !cell){return "";}if(this.customCellData && array.has(this.customCellDataCols, i)){return this.customCellData.call(null, this, cell, i);}else {return dom.getText(cell);}}, writable:true, configurable:true}, getTableData:{value:function getTableData(){var row=this.tbl.rows;for(var k=this.refRow; k < this.nbRows; k++) {var rowData=[k, []];var cells=row[k].cells;for(var j=0; j < cells.length; j++) {var cell_data=this.getCellData(j, cells[j]);rowData[1].push(cell_data);}this.tblData.push(rowData);}return this.tblData;}, writable:true, configurable:true}, getFilteredData:{value:function getFilteredData(includeHeaders){if(!this.validRowsIndex){return [];}var row=this.tbl.rows, filteredData=[];if(includeHeaders){var table=this.gridLayout?this.headTbl:this.tbl, r=table.rows[this.headersRow], rowData=[r.rowIndex, []];for(var j=0; j < this.nbCells; j++) {var headerText=this.getCellData(j, r.cells[j]);rowData[1].push(headerText);}filteredData.push(rowData);}var validRows=this.getValidRowsIndex(true);for(var i=0; i < validRows.length; i++) {var rData=[this.validRowsIndex[i], []], cells=row[this.validRowsIndex[i]].cells;for(var k=0; k < cells.length; k++) {var cell_data=this.getCellData(k, cells[k]);rData[1].push(cell_data);}filteredData.push(rData);}return filteredData;}, writable:true, configurable:true}, getFilteredDataCol:{value:function getFilteredDataCol(colIndex){if(colIndex === undefined){return [];}var data=this.getFilteredData(), colData=[];for(var i=0; i < data.length; i++) {var r=data[i], d=r[1], c=d[colIndex];colData.push(c);}return colData;}, writable:true, configurable:true}, getRowDisplay:{value:function getRowDisplay(row){if(!this.fltGrid && !types.isObj(row)){return;}return row.style.display;}, writable:true, configurable:true}, validateRow:{value:function validateRow(rowIndex, isValid){var row=this.tbl.rows[rowIndex];if(!row || str.lower(typeof isValid) !== "boolean"){return;}if(this.hasVisibleRows && array.has(this.visibleRows, rowIndex) && !this.paging){isValid = true;}var displayFlag=isValid?"":"none", validFlag=isValid?"true":"false";row.style.display = displayFlag;if(this.paging){row.setAttribute("validRow", validFlag);}}, writable:true, configurable:true}, validateAllRows:{value:function validateAllRows(){if(!this._hasGrid){return;}this.validRowsIndex = [];for(var k=this.refRow; k < this.nbFilterableRows; k++) {this.validateRow(k, true);this.validRowsIndex.push(k);}}, writable:true, configurable:true}, setFilterValue:{value:function setFilterValue(index, searcharg, doFilter){if(!this.fltGrid && !this.isFirstLoad || !this.getFilterElement(index)){return;}var slc=this.getFilterElement(index), execFilter=doFilter === undefined?true:doFilter, fltColType=this["col" + index];searcharg = searcharg === undefined?"":searcharg;if(fltColType !== this.fltTypeMulti && fltColType != this.fltTypeCheckList){slc.value = searcharg;}else if(fltColType === this.fltTypeMulti){var s=searcharg.split(" " + this.orOperator + " "), ct=0;for(var j=0; j < slc.options.length; j++) {if(s === "" || s[0] === ""){slc.options[j].selected = false;}if(slc.options[j].value === ""){slc.options[j].selected = false;}if(slc.options[j].value !== "" && array.has(s, slc.options[j].value, true)){slc.options[j].selected = true;}}}else if(fltColType === this.fltTypeCheckList){searcharg = str.matchCase(searcharg, this.matchCase);var sarg=searcharg.split(" " + this.orOperator + " "), fltValue=slc.setAttribute("value", ""), fltIndex=slc.setAttribute("indexes", "");for(var k=0; k < dom.tag(slc, "li").length; k++) {var li=dom.tag(slc, "li")[k], lbl=dom.tag(li, "label")[0], chk=dom.tag(li, "input")[0], lblTxt=str.matchCase(dom.getText(lbl), this.matchCase);if(lblTxt !== "" && array.has(sarg, lblTxt, true)){chk.checked = true;this.Cpt.checkList.setCheckListValues(chk);}else {chk.checked = false;this.Cpt.checkList.setCheckListValues(chk);}}}}, writable:true, configurable:true}, setColWidths:{value:function setColWidths(rowIndex){if(!this.fltGrid || !this.hasColWidth){return;}var o=this, rIndex;if(rowIndex === undefined){rIndex = this.tbl.rows[0].style.display != "none"?0:1;}else {rIndex = rowIndex;}setWidths(this.tbl.rows[rIndex]);function setWidths(row){if(!o && o.nbCells != o.colWidth.length){return;}if(o.nbCells == row.cells.length){for(var k=0; k < o.nbCells; k++) {row.cells[k].style.width = o.colWidth[k];}}}}, writable:true, configurable:true}, enforceVisibility:{value:function enforceVisibility(){if(this._hasGrid && this.hasVisibleRows && !this.paging){for(var i=0; i < this.visibleRows.length; i++) {if(this.visibleRows[i] <= this.nbRows){this.validateRow(this.visibleRows[i], true);}}}}, writable:true, configurable:true}, clearFilters:{value:function clearFilters(){this.EvtManager(this.Evt.name.clear);}, writable:true, configurable:true}, _clearFilters:{value:function _clearFilters(){if(!this.fltGrid){return;}if(this.onBeforeReset){this.onBeforeReset.call(null, this, this.getFiltersValue());}for(var i=0; i < this.fltIds.length; i++) {this.setFilterValue(i, "");}if(this.linkedFilters){this.activeFilterId = "";this.linkFilters();}if(this.rememberPageLen){cookie.remove(this.pgLenCookie);}if(this.rememberPageNb){cookie.remove(this.pgNbCookie);}if(this.onAfterReset){this.onAfterReset.call(null, this);}}, writable:true, configurable:true}, clearActiveColumns:{value:function clearActiveColumns(){for(var i=0; i < this.fltIds.length; i++) {dom.removeClass(this.getHeaderElement(i), this.activeColumnsCssClass);}}, writable:true, configurable:true}, refresh:{value:function refresh(config){var configObj=!config?this.cfg:config;var hasSort=this.sort;if(hasSort){this.sort = false;}this.nbRows = this.getRowsNb();this.remove();window["tf_" + this.id] = new TableFilter(this.id, this.startRow, configObj);this.isFirstLoad = true;this.fltIds = [];this.init();if(hasSort){this.st.setTBody(this.tbl.tBodies[0]);this.sort = true;}}, writable:true, configurable:true}, linkFilters:{value:function linkFilters(){var slcA1=this.getFiltersByType(this.fltTypeSlc, true), slcA2=this.getFiltersByType(this.fltTypeMulti, true), slcA3=this.getFiltersByType(this.fltTypeCheckList, true), slcIndex=slcA1.concat(slcA2);slcIndex = slcIndex.concat(slcA3);if(this.activeFilterId){var activeFlt=this.activeFilterId.split("_")[0];activeFlt = activeFlt.split(this.prfxFlt)[1];var slcSelectedValue;for(var i=0; i < slcIndex.length; i++) {var curSlc=dom.id(this.fltIds[slcIndex[i]]);slcSelectedValue = this.getFilterValue(slcIndex[i]);if(activeFlt !== slcIndex[i] || this.paging && array.has(slcA1, slcIndex[i]) && activeFlt === slcIndex[i] || !this.paging && (array.has(slcA3, slcIndex[i]) || array.has(slcA2, slcIndex[i])) || slcSelectedValue === this.displayAllText){if(array.has(slcA3, slcIndex[i])){this.Cpt.checkList.checkListDiv[slcIndex[i]].innerHTML = "";}else {curSlc.innerHTML = "";}if(this.fillSlcOnDemand){var opt0=dom.createOpt(this.displayAllText, "");if(curSlc){curSlc.appendChild(opt0);}}if(array.has(slcA3, slcIndex[i])){this.Cpt.checkList._build(slcIndex[i]);}else {this.Cpt.dropdown._build(slcIndex[i], true);}this.setFilterValue(slcIndex[i], slcSelectedValue);}}}}, writable:true, configurable:true}, _resetGrid:{value:function _resetGrid(){if(this.isFirstLoad){return;}if(!this.gridLayout){this.tbl.rows[this.filtersRowIndex].parentNode.insertBefore(this.fltGridEl, this.tbl.rows[this.filtersRowIndex]);}if(this.isExternalFlt){for(var ct=0; ct < this.externalFltTgtIds.length; ct++) {var extFlt=dom.id(this.externalFltTgtIds[ct]);if(extFlt){extFlt.appendChild(this.externalFltEls[ct]);var colFltType=this["col" + ct];if(this.gridLayout && this.externalFltEls[ct].innerHTML === "" && colFltType !== this.fltTypeInp){if(colFltType === this.fltTypeSlc || colFltType === this.fltTypeMulti){this.Cpt.dropdown.build(ct);}if(colFltType === this.fltTypeCheckList){this.Cpt.checkList.build(ct);}}}}}this.nbFilterableRows = this.getRowsNb();this.nbVisibleRows = this.nbFilterableRows;this.nbRows = this.tbl.rows.length;if(this.isSortEnabled){this.sort = true;}if(this.tbl.rows[this.filtersRowIndex].innerHTML === ""){refreshFilters(this);}else {if(this.popUpFilters){this.headersRow++;this.Cpt.popupFilter.buildAll();}}function refreshFilters(o){o.tbl.deleteRow(o.filtersRowIndex);o.remove();o.fltIds = [];o.isFirstLoad = true;if(o.popUpFilters){o.Cpt.popupFilter.destroy();}o._AddGrid();}if(!this.gridLayout){dom.addClass(this.tbl, this.prfxTf);}this._hasGrid = true;}, writable:true, configurable:true}, _containsStr:{value:function _containsStr(arg, data, fltType, forceMatch){var regexp, modifier=this.matchCase?"g":"gi", exactMatch=!forceMatch?this.exactMatch:forceMatch;if(exactMatch || fltType !== this.fltTypeInp && fltType){regexp = new RegExp("(^\\s*)" + str.rgxEsc(arg) + "(\\s*$)", modifier);}else {regexp = new RegExp(str.rgxEsc(arg), modifier);}return regexp.test(data);}, writable:true, configurable:true}, isImported:{value:function isImported(filePath, type){var imported=false, importType=!type?"script":type, attr=importType == "script"?"src":"href", files=dom.tag(doc, importType);for(var i=0; i < files.length; i++) {if(files[i][attr] === undefined){continue;}if(files[i][attr].match(filePath)){imported = true;break;}}return imported;}, writable:true, configurable:true}, includeFile:{value:function includeFile(fileId, filePath, callback, type){var ftype=!type?"script":type, imported=this.isImported(filePath, ftype);if(imported){return;}var o=this, isLoaded=false, file, head=dom.tag(doc, "head")[0];if(str.lower(ftype) === "link"){file = dom.create("link", ["id", fileId], ["type", "text/css"], ["rel", "stylesheet"], ["href", filePath]);}else {file = dom.create("script", ["id", fileId], ["type", "text/javascript"], ["src", filePath]);}file.onload = file.onreadystatechange = function(){if(!isLoaded && (!this.readyState || this.readyState === "loaded" || this.readyState === "complete")){isLoaded = true;if(typeof callback === "function"){callback.call(null, o);}}};file.onerror = function(){throw new Error("TF script could not load:\n" + this.src);};head.appendChild(file);}, writable:true, configurable:true}, hasGrid:{value:function hasGrid(){return this._hasGrid;}, writable:true, configurable:true}, getFiltersId:{value:function getFiltersId(){if(!this._hasGrid){return;}return this.fltIds;}, writable:true, configurable:true}, getValidRowsIndex:{value:function getValidRowsIndex(reCalc){if(!this._hasGrid){return;}if(!reCalc){return this.validRowsIndex;}this.validRowsIndex = [];for(var k=this.refRow; k < this.getRowsNb(true); k++) {var r=this.tbl.rows[k];if(!this.paging){if(this.getRowDisplay(r) !== "none"){this.validRowsIndex.push(r.rowIndex);}}else {if(r.getAttribute("validRow") === "true" || r.getAttribute("validRow") === null){this.validRowsIndex.push(r.rowIndex);}}}return this.validRowsIndex;}, writable:true, configurable:true}, getFiltersRowIndex:{value:function getFiltersRowIndex(){if(!this._hasGrid){return;}return this.filtersRowIndex;}, writable:true, configurable:true}, getHeadersRowIndex:{value:function getHeadersRowIndex(){if(!this._hasGrid){return;}return this.headersRow;}, writable:true, configurable:true}, getStartRowIndex:{value:function getStartRowIndex(){if(!this._hasGrid){return;}return this.refRow;}, writable:true, configurable:true}, getLastRowIndex:{value:function getLastRowIndex(){if(!this._hasGrid){return;}return this.nbRows - 1;}, writable:true, configurable:true}, getHeaderElement:{value:function getHeaderElement(colIndex){var table=this.gridLayout?this.headTbl:this.tbl;var header, tHead=dom.tag(this.tbl, "thead");for(var i=0; i < this.nbCells; i++) {if(i !== colIndex){continue;}if(tHead.length === 0){header = table.rows[this.headersRow].cells[i];}if(tHead.length === 1){header = tHead[0].rows[this.headersRow].cells[i];}break;}return header;}, writable:true, configurable:true}, config:{value:function config(){return this.cfg;}, writable:true, configurable:true}, getFilterableRowsNb:{value:function getFilterableRowsNb(){return this.getRowsNb(false);}, writable:true, configurable:true}});return TableFilter;})();module.exports = TableFilter;function numSortAsc(a, b){return a - b;}function numSortDesc(a, b){return b - a;}function removeNbFormat(data, format){if(!data){return;}if(!format){format = "us";}var n=data;if(str.lower(format) === "us"){n = +n.replace(/[^\d\.-]/g, "");}else {n = +n.replace(/[^\d\,-]/g, "").replace(",", ".");}return n;}function setOuterHtml(){if(doc.body.__defineGetter__){if(HTMLElement){var element=HTMLElement.prototype;if(element.__defineGetter__){element.__defineGetter__("outerHTML", function(){var parent=this.parentNode;var el=dom.create(parent.tagName);el.appendChild(this);var shtml=el.innerHTML;parent.appendChild(this);return shtml;});}if(element.__defineSetter__){HTMLElement.prototype.__defineSetter__("outerHTML", function(sHTML){var r=this.ownerDocument.createRange();r.setStartBefore(this);var df=r.createContextualFragment(sHTML);this.parentNode.replaceChild(df, this);return sHTML;});}}}}}); +//# sourceMappingURL=core.js.map \ No newline at end of file diff --git a/src/date.js b/src/date.js index fc412f70..08d45c6f 100644 --- a/src/date.js +++ b/src/date.js @@ -1,160 +1,172 @@ define(["exports"], function (exports) { - "use strict"; + "use strict"; - /** - * Date utilities - */ + /** + * Date utilities + */ - var DateHelper = { - isValid: function (dateStr, format) { - if (!format) { - format = "DMY"; - } - format = format.toUpperCase(); - if (format.length != 3) { - if (format === "DDMMMYYYY") { - var d = this.format(dateStr, format); - dateStr = d.getDate() + "/" + (d.getMonth() + 1) + "/" + d.getFullYear(); - format = "DMY"; - } - } - if ((format.indexOf("M") === -1) || (format.indexOf("D") === -1) || (format.indexOf("Y") === -1)) { - format = "DMY"; - } - var reg1, reg2; - // If the year is first - if (format.substring(0, 1) == "Y") { - reg1 = /^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/; - reg2 = /^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/; - } else if (format.substring(1, 2) == "Y") { - // If the year is second - reg1 = /^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/; - reg2 = /^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/; - } else { - // The year must be third - reg1 = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/; - reg2 = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/; - } - // If it doesn't conform to the right format (with either a 2 digit year or - // 4 digit year), fail - if (reg1.test(dateStr) === false && reg2.test(dateStr) === false) { - return false; - } - // Split into 3 parts based on what the divider was - var parts = dateStr.split(RegExp.$1); - var mm, dd, yy; - // Check to see if the 3 parts end up making a valid date - if (format.substring(0, 1) === "M") { - mm = parts[0]; - } else if (format.substring(1, 2) === "M") { - mm = parts[1]; - } else { - mm = parts[2]; - } - if (format.substring(0, 1) === "D") { - dd = parts[0]; - } else if (format.substring(1, 2) === "D") { - dd = parts[1]; - } else { - dd = parts[2]; - } - if (format.substring(0, 1) === "Y") { - yy = parts[0]; - } else if (format.substring(1, 2) === "Y") { - yy = parts[1]; - } else { - yy = parts[2]; - } - if (parseInt(yy, 10) <= 50) { - yy = (parseInt(yy, 10) + 2000).toString(); - } - if (parseInt(yy, 10) <= 99) { - yy = (parseInt(yy, 10) + 1900).toString(); - } - var dt = new Date(parseInt(yy, 10), parseInt(mm, 10) - 1, parseInt(dd, 10), 0, 0, 0, 0); - if (parseInt(dd, 10) != dt.getDate()) { - return false; - } - if (parseInt(mm, 10) - 1 != dt.getMonth()) { - return false; - } - return true; - }, - format: function (dateStr, format) { - if (!format) { - format = "DMY"; - } - if (!dateStr || dateStr === "") { - return new Date(1001, 0, 1); - } - var oDate, parts; + var DateHelper = { + isValid: function isValid(dateStr, format) { + if (!format) { + format = "DMY"; + } + format = format.toUpperCase(); + if (format.length != 3) { + if (format === "DDMMMYYYY") { + var d = this.format(dateStr, format); + dateStr = d.getDate() + "/" + (d.getMonth() + 1) + "/" + d.getFullYear(); + format = "DMY"; + } + } + if (format.indexOf("M") === -1 || format.indexOf("D") === -1 || format.indexOf("Y") === -1) { + format = "DMY"; + } + var reg1, reg2; + // If the year is first + if (format.substring(0, 1) == "Y") { + reg1 = /^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/; + reg2 = /^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/; + } else if (format.substring(1, 2) == "Y") { + // If the year is second + reg1 = /^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/; + reg2 = /^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/; + } else { + // The year must be third + reg1 = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/; + reg2 = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/; + } + // If it doesn't conform to the right format (with either a 2 digit year or + // 4 digit year), fail + if (reg1.test(dateStr) === false && reg2.test(dateStr) === false) { + return false; + } + // Split into 3 parts based on what the divider was + var parts = dateStr.split(RegExp.$1); + var mm, dd, yy; + // Check to see if the 3 parts end up making a valid date + if (format.substring(0, 1) === "M") { + mm = parts[0]; + } else if (format.substring(1, 2) === "M") { + mm = parts[1]; + } else { + mm = parts[2]; + } + if (format.substring(0, 1) === "D") { + dd = parts[0]; + } else if (format.substring(1, 2) === "D") { + dd = parts[1]; + } else { + dd = parts[2]; + } + if (format.substring(0, 1) === "Y") { + yy = parts[0]; + } else if (format.substring(1, 2) === "Y") { + yy = parts[1]; + } else { + yy = parts[2]; + } + if (parseInt(yy, 10) <= 50) { + yy = (parseInt(yy, 10) + 2000).toString(); + } + if (parseInt(yy, 10) <= 99) { + yy = (parseInt(yy, 10) + 1900).toString(); + } + var dt = new Date(parseInt(yy, 10), parseInt(mm, 10) - 1, parseInt(dd, 10), 0, 0, 0, 0); + if (parseInt(dd, 10) != dt.getDate()) { + return false; + } + if (parseInt(mm, 10) - 1 != dt.getMonth()) { + return false; + } + return true; + }, + format: (function (_format) { + var _formatWrapper = function format(_x, _x2) { + return _format.apply(this, arguments); + }; - function y2kDate(yr) { - if (yr === undefined) { - return 0; - } - if (yr.length > 2) { - return yr; - } - var y; - //>50 belong to 1900 - if (yr <= 99 && yr > 50) { - y = "19" + yr; - } - //<50 belong to 2000 - if (yr < 50 || yr === "00") { - y = "20" + yr; - } - return y; - } + _formatWrapper.toString = function () { + return _format.toString(); + }; - function mmm2mm(mmm) { - if (mmm === undefined) { - return 0; - } - var mondigit; - var MONTH_NAMES = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december", "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"]; - for (var m_i = 0; m_i < MONTH_NAMES.length; m_i++) { - var month_name = MONTH_NAMES[m_i]; - if (mmm.toLowerCase() === month_name) { - mondigit = m_i + 1; - break; - } - } - if (mondigit > 11 || mondigit < 23) { - mondigit = mondigit - 12; - } - if (mondigit < 1 || mondigit > 12) { - return 0; - } - return mondigit; - } + return _formatWrapper; + })(function (dateStr, format) { + if (!format) { + format = "DMY"; + } + if (!dateStr || dateStr === "") { + return new Date(1001, 0, 1); + } + var oDate, parts; - switch (format.toUpperCase()) { - case "DDMMMYYYY": - parts = dateStr.replace(/[- \/.]/g, " ").split(" "); - oDate = new Date(y2kDate(parts[2]), mmm2mm(parts[1]) - 1, parts[0]); - break; - case "DMY": - parts = dateStr.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/, "$1 $3 $5").split(" "); - oDate = new Date(y2kDate(parts[2]), parts[1] - 1, parts[0]); - break; - case "MDY": - parts = dateStr.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/, "$1 $3 $5").split(" "); - oDate = new Date(y2kDate(parts[2]), parts[0] - 1, parts[1]); - break; - case "YMD": - parts = dateStr.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/, "$1 $4 $6").split(" "); - oDate = new Date(y2kDate(parts[0]), parts[1] - 1, parts[2]); - break; - default: //in case format is not correct - parts = dateStr.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/, "$1 $3 $5").split(" "); - oDate = new Date(y2kDate(parts[2]), parts[1] - 1, parts[0]); - break; - } - return oDate; - } - }; + function y2kDate(yr) { + if (yr === undefined) { + return 0; + } + if (yr.length > 2) { + return yr; + } + var y; + //>50 belong to 1900 + if (yr <= 99 && yr > 50) { + y = "19" + yr; + } + //<50 belong to 2000 + if (yr < 50 || yr === "00") { + y = "20" + yr; + } + return y; + } - exports.DateHelper = DateHelper; -}); \ No newline at end of file + function mmm2mm(mmm) { + if (mmm === undefined) { + return 0; + } + var mondigit; + var MONTH_NAMES = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december", "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"]; + for (var m_i = 0; m_i < MONTH_NAMES.length; m_i++) { + var month_name = MONTH_NAMES[m_i]; + if (mmm.toLowerCase() === month_name) { + mondigit = m_i + 1; + break; + } + } + if (mondigit > 11 || mondigit < 23) { + mondigit = mondigit - 12; + } + if (mondigit < 1 || mondigit > 12) { + return 0; + } + return mondigit; + } + + switch (format.toUpperCase()) { + case "DDMMMYYYY": + parts = dateStr.replace(/[- \/.]/g, " ").split(" "); + oDate = new Date(y2kDate(parts[2]), mmm2mm(parts[1]) - 1, parts[0]); + break; + case "DMY": + parts = dateStr.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/, "$1 $3 $5").split(" "); + oDate = new Date(y2kDate(parts[2]), parts[1] - 1, parts[0]); + break; + case "MDY": + parts = dateStr.replace(/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/, "$1 $3 $5").split(" "); + oDate = new Date(y2kDate(parts[2]), parts[0] - 1, parts[1]); + break; + case "YMD": + parts = dateStr.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/, "$1 $4 $6").split(" "); + oDate = new Date(y2kDate(parts[0]), parts[1] - 1, parts[2]); + break; + default: + //in case format is not correct + parts = dateStr.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/, "$1 $3 $5").split(" "); + oDate = new Date(y2kDate(parts[2]), parts[1] - 1, parts[0]); + break; + } + return oDate; + }) + }; + + exports.DateHelper = DateHelper; +}); +//# sourceMappingURL=date.js.map \ No newline at end of file diff --git a/src/dom.js b/src/dom.js index f0f80123..fc30b8ca 100644 --- a/src/dom.js +++ b/src/dom.js @@ -1,156 +1,162 @@ define(["exports"], function (exports) { - "use strict"; + "use strict"; - /** - * DOM utilities - */ + /** + * DOM utilities + */ - var Dom = {}; + var Dom = {}; - /** - * Returns text + text of children of given node - * @param {NodeElement} node - * @return {String} - */ - Dom.getText = function (node) { - var s = node.textContent || node.innerText || node.innerHTML.replace(/<[^<>]+>/g, ""); - s = s.replace(/^\s+/, "").replace(/\s+$/, ""); - return s; - }; + /** + * Returns text + text of children of given node + * @param {NodeElement} node + * @return {String} + */ + Dom.getText = function (node) { + var s = node.textContent || node.innerText || node.innerHTML.replace(/<[^<>]+>/g, ""); + s = s.replace(/^\s+/, "").replace(/\s+$/, ""); + return s; + }; - /** - * Creates an html element with given collection of attributes - * @param {String} tag a string of the html tag to create - * @param {Array} an undetermined number of arrays containing the with 2 - * items, the attribute name and its value ['id','myId'] - * @return {Object} created element - */ - Dom.create = function (tag) { - if (!tag || tag === "") { - return; - } - - var el = document.createElement(tag), args = arguments; - - if (args.length > 1) { - for (var i = 0; i < args.length; i++) { - var argtype = typeof args[i]; - if (argtype.toLowerCase() === "object" && args[i].length === 2) { - el.setAttribute(args[i][0], args[i][1]); + /** + * Creates an html element with given collection of attributes + * @param {String} tag a string of the html tag to create + * @param {Array} an undetermined number of arrays containing the with 2 + * items, the attribute name and its value ['id','myId'] + * @return {Object} created element + */ + Dom.create = function (tag) { + if (!tag || tag === "") { + return; } - } - } - return el; - }; - /** - * Returns a text node with given text - * @param {String} text - * @return {Object} - */ - Dom.text = function (text) { - return document.createTextNode(text); - }; + var el = document.createElement(tag), + args = arguments; - /** - * Returns offset position of passed element - * @param {object} obj [description] - * @return {object} literal object with left and top values - */ - Dom.position = function (obj) { - var l = 0, t = 0; - if (obj && obj.offsetParent) { - do { - l += obj.offsetLeft; - t += obj.offsetTop; - } while (obj == obj.offsetParent); - } - return { left: l, top: t }; - }; + if (args.length > 1) { + for (var i = 0; i < args.length; i++) { + var argtype = typeof args[i]; + if (argtype.toLowerCase() === "object" && args[i].length === 2) { + el.setAttribute(args[i][0], args[i][1]); + } + } + } + return el; + }; - Dom.hasClass = function (ele, cls) { - if (!ele) { - return false; + /** + * Returns a text node with given text + * @param {String} text + * @return {Object} + */ + Dom.text = function (text) { + return document.createTextNode(text); + }; + + /** + * Returns offset position of passed element + * @param {object} obj [description] + * @return {object} literal object with left and top values + */ + Dom.position = function (obj) { + var l = 0, + t = 0; + if (obj && obj.offsetParent) { + do { + l += obj.offsetLeft; + t += obj.offsetTop; + } while (obj == obj.offsetParent); + } + return { left: l, top: t }; + }; + + Dom.hasClass = function (ele, cls) { + if (!ele) { + return false; + } + + if (supportsClassList()) { + return ele.classList.contains(cls); + } + return ele.className.match(new RegExp("(\\s|^)" + cls + "(\\s|$)")); + }; + + Dom.addClass = function (ele, cls) { + if (!ele) { + return; + } + + if (supportsClassList()) { + ele.classList.add(cls); + return; + } + + if (ele.className === "") { + ele.className = cls; + } else if (!this.hasClass(ele, cls)) { + ele.className += " " + cls; + } + }; + + Dom.removeClass = function (ele, cls) { + if (!ele) { + return; + } + + if (supportsClassList()) { + ele.classList.remove(cls); + return; + } + var reg = new RegExp("(\\s|^)" + cls + "(\\s|$)", "g"); + ele.className = ele.className.replace(reg, ""); + }; + + /** + * Creates and returns an option element + * @param {String} text option text + * @param {String} value option value + * @param {Boolean} isSel whether option is selected + * @return {Object} option element + */ + Dom.createOpt = function (text, value, isSel) { + var isSelected = isSel ? true : false, + opt = isSelected ? this.create("option", ["value", value], ["selected", "true"]) : this.create("option", ["value", value]); + opt.appendChild(this.text(text)); + return opt; + }; + + /** + * Creates and returns a checklist item + * @param {Number} chkIndex index of check item + * @param {String} chkValue check item value + * @param {String} labelText check item label text + * @return {Object} li DOM element + */ + Dom.createCheckItem = function (chkIndex, chkValue, labelText) { + var li = this.create("li"), + label = this.create("label", ["for", chkIndex]), + check = this.create("input", ["id", chkIndex], ["name", chkIndex], ["type", "checkbox"], ["value", chkValue]); + label.appendChild(check); + label.appendChild(this.text(labelText)); + li.appendChild(label); + li.label = label; + li.check = check; + return li; + }; + + Dom.id = function (id) { + return document.getElementById(id); + }; + + Dom.tag = function (o, tagname) { + return o.getElementsByTagName(tagname); + }; + + // HTML5 classList API + function supportsClassList() { + return document.documentElement.classList; } - if (supportsClassList()) { - return ele.classList.contains(cls); - } - return ele.className.match(new RegExp("(\\s|^)" + cls + "(\\s|$)")); - }; - - Dom.addClass = function (ele, cls) { - if (!ele) { - return; - } - - if (supportsClassList()) { - ele.classList.add(cls); - return; - } - - if (ele.className === "") { - ele.className = cls; - } else if (!this.hasClass(ele, cls)) { - ele.className += " " + cls; - } - }; - - Dom.removeClass = function (ele, cls) { - if (!ele) { - return; - } - - if (supportsClassList()) { - ele.classList.remove(cls); - return; - } - var reg = new RegExp("(\\s|^)" + cls + "(\\s|$)", "g"); - ele.className = ele.className.replace(reg, ""); - }; - - /** - * Creates and returns an option element - * @param {String} text option text - * @param {String} value option value - * @param {Boolean} isSel whether option is selected - * @return {Object} option element - */ - Dom.createOpt = function (text, value, isSel) { - var isSelected = isSel ? true : false, opt = isSelected ? this.create("option", ["value", value], ["selected", "true"]) : this.create("option", ["value", value]); - opt.appendChild(this.text(text)); - return opt; - }; - - /** - * Creates and returns a checklist item - * @param {Number} chkIndex index of check item - * @param {String} chkValue check item value - * @param {String} labelText check item label text - * @return {Object} li DOM element - */ - Dom.createCheckItem = function (chkIndex, chkValue, labelText) { - var li = this.create("li"), label = this.create("label", ["for", chkIndex]), check = this.create("input", ["id", chkIndex], ["name", chkIndex], ["type", "checkbox"], ["value", chkValue]); - label.appendChild(check); - label.appendChild(this.text(labelText)); - li.appendChild(label); - li.label = label; - li.check = check; - return li; - }; - - Dom.id = function (id) { - return document.getElementById(id); - }; - - Dom.tag = function (o, tagname) { - return o.getElementsByTagName(tagname); - }; - - // HTML5 classList API - function supportsClassList() { - return document.documentElement.classList; - } - - exports.Dom = Dom; -}); \ No newline at end of file + exports.Dom = Dom; +}); +//# sourceMappingURL=dom.js.map \ No newline at end of file diff --git a/src/event.js b/src/event.js index ab15ba31..97488e66 100644 --- a/src/event.js +++ b/src/event.js @@ -1,50 +1,51 @@ define(["exports"], function (exports) { - "use strict"; + "use strict"; - /** - * DOM event utilities - */ + /** + * DOM event utilities + */ - var Event = { - add: function (obj, type, func, capture) { - if (obj.addEventListener) { - obj.addEventListener(type, func, capture); - } else if (obj.attachEvent) { - obj.attachEvent("on" + type, func); - } else { - obj["on" + type] = func; - } - }, - remove: function (obj, type, func, capture) { - if (obj.detachEvent) { - obj.detachEvent("on" + type, func); - } else if (obj.removeEventListener) { - obj.removeEventListener(type, func, capture); - } else { - obj["on" + type] = null; - } - }, - stop: function (evt) { - if (!evt) { - evt = window.event; - } - if (evt.stopPropagation) { - evt.stopPropagation(); - } else { - evt.cancelBubble = true; - } - }, - cancel: function (evt) { - if (!evt) { - evt = window.event; - } - if (evt.preventDefault) { - evt.preventDefault(); - } else { - evt.returnValue = false; - } - } - }; + var Event = { + add: function add(obj, type, func, capture) { + if (obj.addEventListener) { + obj.addEventListener(type, func, capture); + } else if (obj.attachEvent) { + obj.attachEvent("on" + type, func); + } else { + obj["on" + type] = func; + } + }, + remove: function remove(obj, type, func, capture) { + if (obj.detachEvent) { + obj.detachEvent("on" + type, func); + } else if (obj.removeEventListener) { + obj.removeEventListener(type, func, capture); + } else { + obj["on" + type] = null; + } + }, + stop: function stop(evt) { + if (!evt) { + evt = window.event; + } + if (evt.stopPropagation) { + evt.stopPropagation(); + } else { + evt.cancelBubble = true; + } + }, + cancel: function cancel(evt) { + if (!evt) { + evt = window.event; + } + if (evt.preventDefault) { + evt.preventDefault(); + } else { + evt.returnValue = false; + } + } + }; - exports.Event = Event; -}); \ No newline at end of file + exports.Event = Event; +}); +//# sourceMappingURL=event.js.map \ No newline at end of file diff --git a/src/helpers.js b/src/helpers.js index 57ba4410..023c3729 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -1,15 +1,16 @@ define(["exports"], function (exports) { - "use strict"; + "use strict"; - /** - * Misc helpers - */ + /** + * Misc helpers + */ - var Helpers = { - isIE: function () { - return (/msie|MSIE/).test(navigator.userAgent); - } - }; + var Helpers = { + isIE: function isIE() { + return /msie|MSIE/.test(navigator.userAgent); + } + }; - exports.Helpers = Helpers; -}); \ No newline at end of file + exports.Helpers = Helpers; +}); +//# sourceMappingURL=helpers.js.map \ No newline at end of file diff --git a/src/index.html b/src/index.html index 2659fcc8..0b99bd8e 100644 --- a/src/index.html +++ b/src/index.html @@ -87,7 +87,7 @@